Library for communication with PCF8575 IO expander over I2C
Project description
PCF8575
Python library for the PCF8575 I2C IO expander. It abstracts the 16 bit IO port as a Python list, and allows the read/writing of individual pins or the whole port at once. This is a modified version of the PCF8574 library to support the extra 8 ports.
Installation
The library depends on the smbus-cffi package. You may need to apt-get install libffi-dev if you're on a debian based system. Otherwise, simply:
pip install pcf8575
Usage
In [1]: from pcf8575 import PCF8575
In [2]: i2c_port_num = 1
In [3]: pcf_address = 0x20
In [4]: pcf = PCF8575(i2c_port_num, pcf_address)
In [5]: pcf.port
Out[5]: [True, True, True, True, True, True, True, True]
In [6]: pcf.port[0] = False
In [7]: pcf.port
Out[7]: [False, True, True, True, True, True, True, True]
In [8]: pcf.port = [True, False, True, False, True, False, True, False]
In [9]: pcf.port
Out[9]: [True, False, True, False, True, False, True, False]
In [10]: pcf.port[7]
Out[10]: False
In [11]: pcf.port[6]
Out[11]: True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pcf8575-0.3.tar.gz.
File metadata
- Download URL: pcf8575-0.3.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aef516b568f5c565173954121ae61ee1f4b2cd87a9514b8357a0cdb65771561c
|
|
| MD5 |
ed01db5149cd515cdd74ff7eabfc5c2c
|
|
| BLAKE2b-256 |
a7ca59847f71b95b30114b79eefced82886b0b0aad9b316e07d321317ac78bbf
|
File details
Details for the file pcf8575-0.3-py3-none-any.whl.
File metadata
- Download URL: pcf8575-0.3-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
827ee6d62c3358b239e36af8824bc5ee8b2795a88d9cce640b2f016050e2db86
|
|
| MD5 |
ea58da6f9b82d994b1f8019bd6896776
|
|
| BLAKE2b-256 |
f4e806f3e3acc7acc115f5ca7aa1334fc7d28618ac3678a8e068dd28f1ac3fef
|