Basic LED blinking w/ Raspberry Pi

Now I’m not going to show how to setup Raspbian or SSH with your Pi. There are tons of tutorials online how to do that. I will however guide you through to setting up the necessary software for Raspbian to be able to control the pins on the Raspberry Pi.


  • Working Raspbian OS
  • SSH connection or keyboard and display hooked up to Raspberry Pi
  • Two breadboard jumper wires female to male
  • 330 Ω resistor
  • LED

Connecting the components

Now, the pins on the Raspberry Pi are usually called the GPIO pins, which is short for General-Purpose Input/Output. This is explained so you don’t get confused whenever you hear “gpio”  in the forums. These pins are layed out with in two headers if you have the Mod B rev. 2 version. If you have another version you should only have one header. These two headers are called P1 and P5. The P5 is the header only available on the Mod B rev.2, and it’s purpose is to give the possibility to connect from under the Raspberry Pi. P1 is the header we will be using and is available throughout the different Pi models.

Observe! This pin layout is for the Raspberry Pi Mod B rev. 2!. Make sure you have this model before using the below layout as cheat sheet!


Raspberry Pi Mod B rev. 2 pin layout


Connect the first female-male wire from the GPIO 17 to the resistor, the resistor should connect the the anode of the LED. The LED’s cathode should connect to the second wire and the wire should then connect to one of the GND-pins

So GPIO 17 –> wire –> resistor –> LED’s anode –> LED’s cathode –> wire –> GND pin

Installing the required software

Next is to get the software ready. There are several ways to control the GPIO pins with software. The easiest way is to use GPIO-utility which is supplied by WiringPi.
To install WiringPi run these commands:

git clone git://
cd wiringPi
cd wiringPi

Turning the LED on and off

When the installation is done you can now use the GPIO-utility by running

gpio -g mode 17 out

The code about sets the GPIO 17 pin as output for +3.3V.

To turn on the LED run this code:

gpio -g write 17 1

Here’s how it looks on my end:


LED in the HIGH state

To turn the LED off again run

gpio -g write 17 0


If you have any questions feel free to ask me by using the Contact page or the comments below.


A second year computer engineering student at Malmö University in Sweden just having some fun with this blog. Computer Engineering and Mobile IT: Bachelor of Science in engineering

You may also like...

2 Responses

  1. tips for anxiety attacks says:

    Hello very cool website!! Man .. Excellent .. Superb .. I’ll bookmark your website and take the feeds also? I’m happy to find a lot of useful information right here in the publish, we need develop extra techniques on this regard, thank you for sharing.

  2. exposed skin care says:

    I like the helpful information you provide in your articles. I will bookmark your blog and check again here regularly. I’m quite sure I’ll learn many new stuff right here! Best of luck for the next!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.