Skip to main content

Library to control Multi-IO Automation Card

Project description

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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sm16relind-1.0.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sm16relind-1.0.4-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file sm16relind-1.0.4.tar.gz.

File metadata

  • Download URL: sm16relind-1.0.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for sm16relind-1.0.4.tar.gz
Algorithm Hash digest
SHA256 c4f3f53385e46095ce546c56e30016bb5a18f92266f025a01e2b411292e7e7a6
MD5 f55eabe2037770850daa1d959406c990
BLAKE2b-256 b6fb8759c6d8b4976bca357bfb1f9c165599602a465710cd3ad5db16fcdf7cc8

See more details on using hashes here.

File details

Details for the file sm16relind-1.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: sm16relind-1.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.2

File hashes

Hashes for sm16relind-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 89e6754b8d43dfc13ead49516b1b240dab6bf62e2437511d9fdeb491540d4939
MD5 2b2ae81f80b95ed94c2c397c2fa92c6a
BLAKE2b-256 3bbd9b2dcb43a5d6eee3e4fee591eee4afe8863e278aad6d5c531ecdcf4b54aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page