python-asiri provides a Python interface similar to the Raspberry Pi GPIO libery for working with GPIO in Asri, using a MCP230xx chip.
- Handling of digital inputs / outputs
- Support for builtin pullup resistors
All functionality is baked into the
from asiri import GPIO
GPIO instance for working with the MCP23017:
my_gpio = GPIO(num_gpios=16)
Configuring a pin as output:
Setting an output pin to high:
Setting an output pin to low:
Configuring a pin as input:
Read the value of a given pin:
value = my_gpio.input(8)
NOTE: The pin numbering is as follows (for the MCP23017): bank A: pins 0-7, bank B: ping 8-15. On these examples pin 8 was used, that is, B0, or pin 0 from bank B.
- Add support for interrupts
- Add functions to read all inputs from a given bank
BSD, derived from Adafruit's helper libraries.