Nuffnang Ads

Wednesday, 10 September 2014

Raspberry Pi GPIO - LED blinking (wiring Pi + bash script)

This entry is same as the previous post except, this time using the WiringPi method.

I assume that, the LED already connected to the GPIO as shown in here.

1) Open the Raspberry pi terminal, run the following commands:-

sudo apt-get install git-core
sudo apt-get update
sudo apt-get upgrade
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

2) To verify wiring pi, run the following command:-
gpio -v

3) In wiringPi, GPIO4 => GPIO.7. First make the pin as output pin. The command is:
"gpio mode 7 out". Verify the GPIO.7 pin mode using "gpio readall"
GPIO.7 mode = OUT

4) To turn on LED, use "gpio write 7 1". We also can verify the GPIO status using gpio readall command.
gpio readall output when LED off

gpio readall output when LED on


5) Create a new bash (.sh) file

6) I wrote a simple bash script to make the LED blinking 100 times for every seconds.


7) Save the .sh file and make it executable by using chmod +x test.sh.

8) Run the bash script
./test.sh
LED is blinking 

9) Done

Refereces
[1] http://wiringpi.com/

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete