If you're following along with a Raspberry Pi, Beaglebone or any other supported small linux computer, we'll use a special library called adafruit_blinka (named after Blinka, the CircuitPython mascot) to provide the layer that translates the CircuitPython hardware API to whatever library the Linux board provides. It's CircuitPython, on Pi!
In this page we'll assume you've already gotten your Raspberry Pi up and running and can log into the command line.
Go ahead and ssh into your Raspberry Pi via terminal or a ssh client:
Run the standard updates:
sudo apt-get update
sudo apt-get upgrade
and
sudo pip3 install --upgrade setuptools
The default python on your computer may not be python 3. Python 2 is officially discontinued and all our libraries are Python 3 only.
We'll be using python3
and pip3
in our commands, use those versions of python and pip to make sure you're using 3 and not 2
Now you're ready to install all the python support
Run the following command to install the Raspberry PI GPIO library:
pip3 install RPI.GPIO
Run the following command to install adafruit_blinka
pip3 install adafruit-blinka
The computer will install a few different libraries such as adafruit-pureio
(our ioctl-only i2c library), spidev
(for SPI interfacing), Adafruit-GPIO
(for detecting your board) and of course adafruit-blinka
We'll also need to install the Adafruit IO Python Client Library to communicate with Adafruit IO.
Run the following command to install the Adafruit IO Client for Python:
pip3 install adafruit-io
The example code is contained within the Python IO Client's examples/basics subdirectory.
Navigate to the root directory of your Pi:
cd ~
Then, download the latest version of the adafruit/io-client-python repository by running:
git clone https://github.com/adafruit/io-client-python.git
Navigate to that folder's example folder for the examples:
cd io-client-python/examples/basics/
That's it! We're all set up.
Next, let's upload some code and learn how it works.