https://github.com/charkster/mcp23017
Python driver for MCP23017, I2C controlled GPIO expander with 16 GPIOs and 2 interrupt pins.
https://github.com/charkster/mcp23017
mcp23017 micropython raspberry-pi
Last synced: about 1 month ago
JSON representation
Python driver for MCP23017, I2C controlled GPIO expander with 16 GPIOs and 2 interrupt pins.
- Host: GitHub
- URL: https://github.com/charkster/mcp23017
- Owner: charkster
- License: mit
- Created: 2021-10-25T01:31:15.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-05T05:55:06.000Z (almost 2 years ago)
- Last Synced: 2025-06-07T19:03:31.385Z (about 1 year ago)
- Topics: mcp23017, micropython, raspberry-pi
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCP23017

Python driver for MCP23017, I2C controlled GPIO expander with 16 GPIOs and 2 interrupt pins.
Written for both Raspberry Pi and MicroPython. I wanted the functions to look as similar to RPi.GPIO, as that is what I am used to. Written as a proof of concept before I start using the part with a MCU (using a different C library). My favorite feature of the MCP23017 is that the I2C can be at 3.3V and the GPIO can run at 5V. Be sure to tie the A0, A1, A2 (and Reset) to static voltages before using as these pins do not have weak pull-ups or pull-downs. If you are using the DIP package, the datasheet incorrectly shows the reset pin as an output. Drive it high if you don't want to reset the part.
I use read-modify-write when setting register values. "& ( 0xFF - (1 << int(pin[1])))" is used to clear a single bit and "| (1 << int(pin[1]))" is used to set a single bit. They are used frequently.