Adafruit Pi Code

To make life easy for those wishing to experiment with attaching electronics to their Pi, Adafruit have produced an extensive and extremely useful collection of code. This includes simple Python libraries for a large number of modules, including displays, sensors and PWM controllers etc.

To fetch this code, you need to use some software called 'git'. This comes pre-installed on Occidentalis, but on Raspbian you must install it by entering the following commands into LX Terminal.  

You will find the icon for LX Terminal on your desktop.

Before we go any further, issue the following command in LXTerminal. This will ensure your package can be found and that you get the latest version. It does not matter which directory you are in.

sudo apt-get update
The update may take a while, especially if this is the first time you have run it on your Pi. Eventually it should give you another command prompt '$' and it will be ready for you to type the next command which is:
sudo apt-get install git

Once git is installed (if its not already there) you can "check out" the Adafruit Pi Python repository onto your Pi using the following commands

git clone http://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
cd Adafruit-Raspberry-Pi-Python-Code
ls

If there is any problem during any of the steps above, you will see an error message. The most common reasons why something should fail to install are:

  • a problem with your Internet connections

  • a mis-typed command. Remember everything in Linux is case sensitive. It is best to open this page on your Raspberry Pi so you can just copy and paste the commands.

You will find all sorts of goodies in here, many of which we will use in later tutorials.

Last updated on 2015-05-04 at 04.27.11 PM Published on 2012-12-14 at 09.28.57 AM