View: 15573|Reply: 8

OrangePi PC - second led

[Copy link]

2

threads

30

posts

250

credits

Intermediate member

Rank: 3Rank: 3

credits
250
Published in 2016-5-17 15:22:06 | Show all floors |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| Published in 2016-5-19 05:18:27 | Show all floors
I see that Armbian uses two LEDs (green and red)  great

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-5-20 20:51:07 | Show all floors
$ 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| Published in 2016-5-23 01:30:45 from mobile | Show all floors
Can be accesed via WiringOP ? What port number ?

10

threads

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-5-23 06:40:51 | Show all floors
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 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| Published in 2016-5-23 15:25:13 | Show all floors
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

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-5-25 20:02:15 | Show all floors
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 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| Published in 2016-5-26 19:34:51 | Show all floors
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

218

posts

2040

credits

Gold member

Rank: 6Rank: 6

credits
2040
Published in 2016-5-27 18:16:47 | Show all floors
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 need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list