Light LED in Raspberry Pi

Command

1
2
3
4
5
6
7
login as root: su - root
connect gpio 17 pin and GND pin
echo 17 > /sys/class/gpio/export
echo out > /sys/class/gpio/direction
echo 1 > /sys/class/gpio/value # LED bright
echo 0 > /sys/class/gpio/value # LED dim
echo 17 > /sys/class/gpio/unexport

WiringPi

1
2
3
gpio mode 0 out
gpio write 0 1
gpio write 0 0

WiringPi-python

1
2
3
4
5
6
7
8
9
10
sudo get-apt install python-dev python-pip
sudo pip install wiringpi
or
sudo esay_install-2.7 wiringpi
blink.py
import wiringpi
io = wiringpi.GPIO(wiringpi.WPI_MODE_SYS)
io.pinMode(17,io.OUTPUT)
io.digitalWrite(18,io.HIGH) # Turn on light
io.digitalWrite(18,io.LOW) # Turn off

Reference

https://github.com/Gadgetoid/WiringPi2-Python
http://wiringpi.com/