https://github.com/saghul/python-asiri
GPIO interface for Asiri board with a MCP230XX chip
https://github.com/saghul/python-asiri
Last synced: 14 days ago
JSON representation
GPIO interface for Asiri board with a MCP230XX chip
- Host: GitHub
- URL: https://github.com/saghul/python-asiri
- Owner: saghul
- License: mit
- Created: 2013-10-29T21:43:51.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-10-29T21:44:13.000Z (over 12 years ago)
- Last Synced: 2026-02-05T11:03:37.308Z (6 months ago)
- Language: Python
- Size: 102 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
python-asiri
============
Overview
--------
python-asiri provides a Python interface similar to the Raspberry Pi GPIO libery for working
with GPIO in Asri, using a MCP230xx chip.
Features
--------
* Handling of digital inputs / outputs
* Support for builtin pullup resistors
API
---
All functionality is baked into the ``GPIO`` class.
Importing the ``GPIO`` object::
from asiri import GPIO
Creating a ``GPIO`` instance for working with the MCP23017::
my_gpio = GPIO(num_gpios=16)
Configuring a pin as output::
my_gpio.setup(8, GPIO.OUT)
Setting an output pin to high::
my_gpio.output(8, GPIO.HIGH)
Setting an output pin to low::
my_gpio.output(8, GPIO.LOW)
Configuring a pin as input::
my_gpio.setup(8, GPIO.IN)
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.
ToDo
----
* Add support for interrupts
* Add functions to read all inputs from a given bank
License
-------
BSD, derived from Adafruit's helper libraries.