In this post I will take you through the fairly simple task of getting your Raspberry PI to control an LED via the GPIO interface, the task is simple however it lays a great foundation of knowledge for any further projects where you want to interface with an external electronic device.
So the first step is to install some software on to the Raspberry PI operating system via terminal or a remote SSH session. We actually want to install âwiringPiâ however to do that we are going to use the very popular version control tool âgitâ, which should explain the following commands.
1. Software Setup
First we will install the core software required for git to work:
1
|
sudo apt-get install git-core |
Next itâs aways best to ensure that our device is on the lastest version of software, so we will do an update and upgrade, depending on how long until you last did this it could take a while, coffee anyone?
1
2
|
sudo apt-get update sudo apt-get upgrade |
Ok so your back after the software update, now we are going to download the latest release of wiringPi;
1
|
git clone git: //git .drogon.net /wiringPi |
Now go into the directory and just double check with the pull command that you have all the required files.
1
2
|
cd wiringPi git pull origin |
Now time to build the software with a command thatâs fairly easy to remember:
1
|
. /build |
Physical
For the physical setup you will need an LED of your preferred colour, a small 270 ohm resistor and some wire to connect everything together. I would recommend using a breadboard as well it makes all this cabling and prototyping far easier to setup and tweak.
Below is a very simple diagram on how to setup your circuit.
For more detail: How To: Control LED using Raspberry PI GPIO