Finally I’ve successfully TURN On & Off 3 LED lights on the breadboard.
Major road blocks are:
- Have no idea of which pin is which, say which is 25 pin.
- Don’t know if the LED is connected the right way.
- Strangely the echo command somehow not permitted by RPi.
Answer for Q1, we need multimeter to make sure which pin connect to which line. I’m using a bus to connect all pins to breadboard so this must be checked.
Answer for Q2, with help from Levy I realize the current should be set to flow from pin 25 to GND , not from pin 25 to the negative on the board.
Answer for Q3, it seems the cmd should be entered while you’re at root directory, like:
root@rpi:/# echo "1" > /sys/class/gpio/gpio25/value
So, the whole steps are as followed:
- Say you want to play with pin #25, then enter this, which will create corresponding files & directories needed in the export/:
root@rpi:/sys/class/gpio# echo 25 > export
- Enter this line (don’t know what it means but without this cmd you won’t succeed)
root@rpi:/sys/class/gpio# echo out > /sys/class/gpio/direction
- Then you could start turn on or off that LED installed:
//Turn LED On @ pin #25
root@rpi:/sys/class/gpio# echo 1 > /sys/class/gpio/gpio25/value
//Turn LED Off @ pin #25
root@rpi:/sys/class/gpio# echo 0 > /sys/class/gpio/gpio25/value
I’m referencing the book of Get Started with Raspberry Pi and this Instrctable tutorial. Big difference is the book didn’t mention the step 2 above, which I think it’s a setback for me. Now I could move on to more fun! Hope you also did it!
blue LED on pin #9 and green LED #17
red LED off on pin # 25
via Tumblr http://cyberrob.tumblr.com/post/64285566830
沒有留言:
張貼留言