2. Software Installation
Software installation is nice and easy to, simply follow these steps and you'll be ready to start coding in no time at all!
Make sure your Pi is up-to-date
sudo apt-get update
sudo apt-get upgrade
From the menu select "5 Interfacing Options"
Then select "P5 I2C"
Select "Yes" to enable.
Install WiringPi Python
sudo apt-get install python-dev python-pip
sudo pip install wiringpi
Download Example Code
Please note: examples use WiringPi, a Python 2 specific application. Please ensure you are using Python 2, not Python 3 to run examples. Running on the incorrect version of Python will yield the following error:
ImportError: No module named 'wiringpi'
With all the software installed you are ready to go! If you need a little helping hand to get you started, you can download the sample code from the repo to get a feel of how things work. There are two example scripts "led.py" and "switch_led.py"
led.py gives you a basic example of how to use the MCP23017 pins as outputs.
switch_led.py shows you how to use them ICs as both inputs and outputs, it also makes use of both MCP23017 ICs
multi_switch_led.py is an extended example of the switch_led.py, it uses multiple inputs and outputs
git clone git://github.com/modmypi/MCP23017_HAT.git
sudo python2 led.py
sudo python2 switch_led.py