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://
cd wiringPi

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

8) Run the bash script
LED is blinking 

9) Done



  1. This comment has been removed by the author.

  2. This comment has been removed by the author.

  3. The site is really beneficial for everyone to know about this topic. I think if you read blog than you will get some more information from blog. This is really useful blog.
    หลอด ไฟ led