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.

Download: file
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:
Download: file
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

Download: file
git clone
cd Adafruit-Raspberry-Pi-Python-Code

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.

This guide was first published on Dec 14, 2012. It was last updated on Dec 14, 2012. This page (Adafruit Pi Code) was last updated on Apr 22, 2019.