Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 4888|Reply: 8

OrangePi PC - second led

[Copy link]

2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
Post time 2016-5-17 15:22:06 | Show all posts |Read mode
Hi all,
Orange Pi PC
What is the second motherboard  Led and how it can ON-OFF from within your own program?
(First led is only PowerON ?)

2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
 Author| Post time 2016-5-19 05:18:27 | Show all posts
I see that Armbian uses two LEDs (green and red)  great

10

Threads

217

Posts

1764

Credits

Gold member

Rank: 6Rank: 6

Credits
1764
Post time 2016-5-20 20:51:07 | Show all posts
$ sudo modprobe gpio_sunxi

$ echo "turn on red led"
$ sudo sh -c "echo 1 > /sys/class/gpio_sw/normal_led/data"
$ echo "turn off red led"
$ sudo sh -c "echo 0 > /sys/class/gpio_sw/normal_led/data"

$ echo "turn on yellow led"
$ sudo sh -c "echo 1 > /sys/class/gpio_sw/standby_led/data"
$ echo "turn off yellow led"
$ sudo sh -c "echo 0 > /sys/class/gpio_sw/standby_led/data"

2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
 Author| Post time 2016-5-23 01:30:45 From the mobile phone | Show all posts
Can be accesed via WiringOP ? What port number ?

10

Threads

217

Posts

1764

Credits

Gold member

Rank: 6Rank: 6

Credits
1764
Post time 2016-5-23 06:40:51 | Show all posts
Edited by nopnop2002 at 2016-5-23 07:03
mariuszb replied at 2016-5-23 01:30
Can be accesed via WiringOP ? What port number ?
  1. $ ls -l /sys/class/gpio_sw/*_led
  2. lrwxrwxrwx 1 root root 0 Jan  5  1970 /sys/class/gpio_sw/normal_led -> ../../devices/platform/gpio_sw.1/gpio_sw/PA15
  3. lrwxrwxrwx 1 root root 0 Jan  5  1970 /sys/class/gpio_sw/standby_led -> ../../devices/platform/gpio_sw.0/gpio_sw/PL10
Copy the Code

You can't access via WiringOP

You can access only normal_led via orangepi_PC_gpio_pyH3 about OPI-PC.
https://github.com/duxingkei33/o ... OWER_STATUS_PL10.py




2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
 Author| Post time 2016-5-23 15:25:13 | Show all posts
ok

BTW:
in Armbian on Orange Pi PC it loks like this:
You can deactivate trigger as follows:

echo none >/sys/class/leds/green_led/trigger

and then
echo 1 >/sys/class/leds/green_led/brightness  (or red_led)
echo 0 >/sys/class/leds/green_led/brightness

or trigger eg.
echo heartbeat >/sys/class/leds/green_led/trigger

10

Threads

217

Posts

1764

Credits

Gold member

Rank: 6Rank: 6

Credits
1764
Post time 2016-5-25 20:02:15 | Show all posts
Edited by nopnop2002 at 2016-5-27 06:23

GREAT!!
By the environment of Armbian,
You can control GPIO on/off by the following command.
  1. sudo sh -c "echo 1 > /sys/devices/platform/gpio_sw.0/gpio_sw/PA6/data"
  2. sudo sh -c "echo 0 > /sys/devices/platform/gpio_sw.0/gpio_sw/PA6/data"
  3. sudo sh -c "echo 1 > /sys/devices/platform/gpio_sw.1/gpio_sw/PA13/data"
  4. sudo sh -c "echo 0 > /sys/devices/platform/gpio_sw.1/gpio_sw/PA13/data"
Copy the Code

If there is another command in armbian, please tell me.


2

Threads

30

Posts

250

Credits

Intermediate member

Rank: 3Rank: 3

Credits
250
 Author| Post time 2016-5-26 19:34:51 | Show all posts
You can use https://github.com/zhaolei/WiringOP to control all port

eg. Bash:

# LED Pin - wiringPi pin 0 is BCM_GPIO 17.

PIN=0

gpio mode $PIN out

while true; do
  gpio write $PIN 1
  sleep 0.5
  gpio write $PIN 0
  sleep 0.5
done


eg. C:
// LED Pin - wiringPi pin 0 is BCM_GPIO 17.

#define        LED        0

int main (void)
{
  printf ("Raspberry Pi blink\n") ;

  wiringPiSetup () ;
  pinMode (LED, OUTPUT) ;

  for (;;)
  {
    digitalWrite (LED, HIGH) ;        // On
    delay (500) ;                // mS
    digitalWrite (LED, LOW) ;        // Off
    delay (500) ;
  }
  return 0 ;
}

10

Threads

217

Posts

1764

Credits

Gold member

Rank: 6Rank: 6

Credits
1764
Post time 2016-5-27 18:16:47 | Show all posts
Edited by nopnop2002 at 2016-5-27 18:24

I tested gpio mode and gpio write in RPI(raspbian),OPI(lobris),OPI(armbian).

Everything work fine .


You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2018-9-26 17:03 GMT+8 , Processed in 0.031206 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list