SM16relind
This is the python library to control the Sixteen Relays 8-Layer Stackable HAT for Raspberry Pi.
Install
sudo pip install SM16relind
or (if using python3.x):
sudo pip3 install SM16relind
Update
sudo pip install SM16relind -U
or (if using python3.x):
sudo pip3 install SM16relind -U
Manual installation (without pip)
~$ sudo apt-get update
~$ sudo apt-get install build-essential python-pip python-dev python-smbus git
~$ git clone https://github.com/SequentMicrosystems/16relind-rpi.git
~$ cd 16relind-rpi/python/
~/16relind-rpi/python$ sudo python setup.py install
If you use python3.x repace the last line with:
~/16relind-rpi/python$ sudo python3 setup.py install
Manual update (only if installed without pip)
~$ cd 16relind-rpi/
~/16relind-rpi$ git pull
~$ cd 16relind-rpi/python
~/16relind-rpi/python$ sudo python setup.py install
If you use python3.x repace the last line with:
~/16relind-rpi/python$ sudo python3 setup.py install
Usage example
~$ python
Python 3.10.7 (main, Nov 7 2022, 22:59:03) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import SM16relind
>>> rel = SM16relind.SM16relind(0)
>>> rel.set(1, 1)
>>> rel.get_all()
1
>>>
More usage example in the examples folder
Functions prototype
class SM16relind.SM16relind(stack = 0, i2c = 1)
- Description
- Init the SM16relind object and check the card presence
- Parameters
- stack : Card stack level [0..7] set by the jumpers
- i2c : I2C port number, 1 - Raspberry default , 7 - rock pi 4, etc.
- Returns
- card object
set(relay, val)
- Description
- Set one relay state
- Parameters
- relay: The relay number 1 to 16
- val: The new state of the relay 0 = turn off else turn on
- Returns
- none
set_all(val)
- Description
- Set the state of all relays as a 16 bits bit-map
- Parameters
- val: The new state of all 16 relays, 0 => all off, 15 => all on
- Returns
- none
get(relay)
- Description
- Read one relay state
- Parameters
- relay relay number [1..16]
- Returns
- the state of the relay 0 or 1
get_all()
- Description
- Read the state of all 16 relays
- Parameters
- none
- Returns
- relays state as bitmap [0..65535]
Metadata
Release files for sm16relind 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sm16relind-1.0.4.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sm16relind-1.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 9.4 kB
Release files / sm16relind-1.0.4.tar.gz
| Download URL | sm16relind-1.0.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4f3f53385e46095ce546c56e30016bb5a18f92266f025a01e2b411292e7e7a6
|
|
BLAKE2b-256 checksum How to use checksums |
b6fb8759c6d8b4976bca357bfb1f9c165599602a465710cd3ad5db16fcdf7cc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.2
|
Release files / sm16relind-1.0.4-py2.py3-none-any.whl
| Download URL | sm16relind-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
89e6754b8d43dfc13ead49516b1b240dab6bf62e2437511d9fdeb491540d4939
|
|
BLAKE2b-256 checksum How to use checksums |
3bbd9b2dcb43a5d6eee3e4fee591eee4afe8863e278aad6d5c531ecdcf4b54aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.2
|