This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Library for Raspberry interfacing with MCP23017 (e.g. on a shield)


Created with use of

MCP23017 can be used with bank=0 or bank=1 - what you prefer.

16-bit mode (2-byte write/read) is NOT SUPPORTED at the moment.
The focus is on a more generic interface which supports interrupts and (perhaps) the 8-bit MCP chips also.



quick2wire.i2c (



MCP23017 class
MCP23017 class supports all low level configuration like accessing IOCON register, reading and writing any registers

- Initialize MCP23017 with address
- Optionally configure your Bank bit in constructor (default: BANK = 0)
- Read from specific Register
- Write to specific register
- Setting a specific Bit in IOCON
- Unsetting a specific Bit in IOCON

- Generating of two 8-bit-Port-Objects for a chip

Port Manager Class

Port manager supports more high level operations.

PortManager supplies the following methods to configure and work with an 8-bit-port (like Arduino lib on with more features)

*Set I/O mode*

*Set Pullups*

*Set Input Invert*

*Interrupt enabling*

*Set Inerrupt compare*

*Define Interrupt compare*

- Reading and writing

- Additionally it can handle a interrupt callback by passing a method:


Executing the module
Reading the chip on address 0x20
sudo ./ 32

Simple polling example

from MCP23017 import MCP23017, PortManager, IOCON

#create chip with bank=1 mode on address 0x20
chip1 = MCP23017(0x20, 1)
#create chip with bank=0 mode on address 0x21
chip2 = MCP23017(0x21, 1)

#set some config bits on chip1

#generate ports for chip1 - takes always a dict with keys 'A' and 'B' and the desired RPi GPIO interrupt pins
ports = chip1.generate_ports({'A':4, 'B':17})

#set ports of chip1 as input pins
for name,port in ports.items():
print(" Setting up port "+name)
#Set port to input pin

while True:
for name,port in ports.items():
print(" Reading port "+name)


for setting up callbacks see also

- TODO: implement 16 bit mode, affects:
- read() method
- write() method
- interrupt mirrors setting(?)
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting