View: 31571|Reply: 28

gpio test and leds

[Copy link]

4

threads

6

posts

50

credits

Registered member

Rank: 2

credits
50
Published in 2016-1-5 07:26:04 | Show all floors |Read mode

hi guys , has anyone tried the gpio? just to turn on an LED , the instructions for the raspberry pi 2 can fit ?
thank youhttps://www.youtube.com/watch?v=JNqaSLBCYJw

7

threads

30

posts

388

credits

Intermediate member

Rank: 3Rank: 3

credits
388
Published in 2016-1-5 08:13:17 | Show all floors
i got inspiration for doing my gpio from majsi's Small GPIO lib. i would not recommend driving LED's directly from the GPIO though, like in the video.. in my opinion, you should use a bjt or mosfet.

3

threads

44

posts

1241

credits

Gold member

Rank: 6Rank: 6

credits
1241
Published in 2016-1-5 09:22:21 | Show all floors
You can turn gpio on and off from the command line. The wiringpi examples do not work as wiringpi has not been translated for OPI. To do it from the command line:

sudo echo 1 > /sys/class/gpio_sw/PA1/data

turns on pin 11

sudo echo 0 > /sys/class/gpio_sw/PA1/data

Turns off pin 11
You can also turn on\off the board leds this way. Search the forum. You need to have the sunxi stuff loaded.

3

threads

44

posts

1241

credits

Gold member

Rank: 6Rank: 6

credits
1241
Published in 2016-1-5 09:35:03 | Show all floors
Forgot o mention, you can drive leds directly from the gpio. Use a small resistor in series to limit the current through the led. Works fine.

7

threads

30

posts

388

credits

Intermediate member

Rank: 3Rank: 3

credits
388
Published in 2016-1-5 11:04:56 | Show all floors
yes you can drive leds directly from the gpio header, and for a test it can be ok (if you know what you are doing!). just saying it is bad practise, you should have a buffer / line driver / transistor..

7

threads

30

posts

388

credits

Intermediate member

Rank: 3Rank: 3

credits
388
Published in 2016-1-5 11:08:43 | Show all floors
the H3 datasheet says "buffer strength" 20mA. so as long as you select your resistor carefully...

3

threads

24

posts

184

credits

Registered member

Rank: 2

credits
184
Published in 2016-1-6 04:42:05 | Show all floors
Edited by tranki at 2016-1-6 04:44

a) I have  entered "sudo echo 1 > /sys/class/gpio_sw/PA1/data" in terminal and it prompted
orangepi@OrangePI:~$ sudo echo 1 > /sys/class/gpio_sw/PA1/data
bash: /sys/class/gpio_sw/PA1/data: No such file or directory
b) I thought that i could check the result  without connecting led nor resistence by simulating gpio with command "gpio readall"

3

threads

44

posts

1241

credits

Gold member

Rank: 6Rank: 6

credits
1241
Published in 2016-1-8 23:20:45 | Show all floors
Try:

sudo modprobe gpio-sunxi

and then try:

sudo echo 1 > /sys/class/gpio_sw/PA1/data

take a look at:

http://www.orangepi.org/orangepi ... p;extra=&page=1

1

threads

13

posts

201

credits

Intermediate member

Rank: 3Rank: 3

credits
201
Published in 2016-1-10 20:53:19 | Show all floors
Edited by redo at 2016-1-10 20:56

you can take uln2008, change 12 for 3.3v.
Medecine moderne www.viagrasansordonnancefr.com en vente libre

3

threads

24

posts

184

credits

Registered member

Rank: 2

credits
184
Published in 2016-1-10 21:12:02 | Show all floors
root@OrangePI:~# modprobe gpio-sunxi
bash: modprobe: command not found
root@OrangePI:~#
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list