Skip to content

MCP23017 GPIO-Expander Python Library for RaspberryPi

Notifications You must be signed in to change notification settings

sensorberg/MCP23017-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP23017-python

MCP23017 GPIO-Expander Python Library for RaspberryPi

MCP23017 Datasheet

Features

currently implemented features:

  • set pin mode INPUT or OUTPUT
  • set pin mode of all pins
  • digital write pin HIGH or LOW
  • digital read pin state
  • digital read pin state of all pins
  • enable interrupt on a pin
  • enable interrupt on all pins
  • enable interrupt mirroring of BANK_A and BANK_B
  • read interrupt flags to see which pin triggered the interrupt
  • read the interrupt capture value of the pin when the interrupt happened

Getting started

Setup a MCP23017 object

from mcp23017 import *
from i2c import I2C
import smbus

i2c = I2C(smbus.SMBus(1))  # creates a I2C Object as a wrapper for the SMBus
mcp = MCP23017(0x20, i2c)   # creates an MCP object with the given address

About

MCP23017 GPIO-Expander Python Library for RaspberryPi

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages