Skip to main content

RPiMCP23S17

This is a Python module that abstracts the GPIO expander MCP23S17. It is intended for the use on a Raspberry Pi.

Provided Functions

As a quick overview, the module provides the following functions. Refer to the module documentation for details:

  • open

  • close

  • setPullupMode

  • setDirection

  • digitalRead

  • digitalWrite

  • writeGPIO

  • readGPIO

Installation

If not already done, you need to install PIP via:

sudo apt-get install python-dev python-pip

Install from PyPI:

pip install RPiMCP23S17

Example

The following demo peridically toggles all pins of two MCP23S17 components:

from RPiMCP23S17.MCP23S17 import MCP23S17
import time

mcp1 = MCP23S17(bus=0x00, pin_cs=0x00, device_id=0x00)
mcp2 = MCP23S17(bus=0x00, pin_cs=0x00, device_id=0x01)
mcp1.open()
mcp2.open()

for x in range(0, 16):
    mcp1.setDirection(x, mcp1.DIR_OUTPUT)
    mcp2.setDirection(x, mcp1.DIR_OUTPUT)

print "Starting blinky on all pins (CTRL+C to quit)"
while (True):
    for x in range(0, 16):
        mcp1.digitalWrite(x, MCP23S17.LEVEL_HIGH)
        mcp2.digitalWrite(x, MCP23S17.LEVEL_HIGH)
    time.sleep(1)

    for x in range(0, 16):
        mcp1.digitalWrite(x, MCP23S17.LEVEL_LOW)
        mcp2.digitalWrite(x, MCP23S17.LEVEL_LOW)
    time.sleep(1)

    # the lines below essentially have the same effect as the lines above
    mcp1.writeGPIO(0xFFF)
    mcp2.writeGPIO(0xFFF)
    time.sleep(1)

    mcp1.writeGPIO(0x0)
    mcp2.writeGPIO(0x0)
    time.sleep(1)

Change Log

1.0.0

  • Added possibility to set reset pin

0.2.3

  • Fixed error “NameError: global name ‘MCP23S17_GPIOB’ is not defined” in function digitalRead

0.2.2

  • Fixed example in documentation

0.2.1

  • Updated documentation

0.2.0

  • Reorganized module structure

0.1.1

  • Enhanced package setup script setup.py

  • Updated documentation

0.1.0

  • Initial release

Metadata

Release files for RPiMCP23S17 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RPiMCP23S17 1.0.0
File Size Uploaded Provenance Actions
RPiMCP23S17-1.0.0.tar.gz 5.4 kB Without provenance Details for RPiMCP23S17-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for RPiMCP23S17 1.0.0
File Interpreter ABI Platform Actions
RPiMCP23S17-1.0.0-py3.5.egg Legacy Egg format - - Details for RPiMCP23S17-1.0.0-py3.5.egg
RPiMCP23S17-1.0.0-py3-none-any.whl Python 3 none any Details for RPiMCP23S17-1.0.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / RPiMCP23S17-1.0.0.tar.gz

Download URL RPiMCP23S17-1.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
45667d578468717e6b0e992da7405a603efba0bb5b98d0972ca00796a84b5036
BLAKE2b-256 checksum
How to use checksums
c9f619c421a58aa2b3f5abaaabe2f5b69c9d04826c8d8320010dddf8874703f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / RPiMCP23S17-1.0.0-py3.5.egg

Download URL RPiMCP23S17-1.0.0-py3.5.egg
Size 9.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
4a0fd3afb3a3aa9ab64f5348d8bf61a182fe28ab9ad580c06e5d6116a7c61a41
BLAKE2b-256 checksum
How to use checksums
791bbc79d70b52f11f7b0e78fe30da1befd96c15ad13c86244cf19f5fb8ec117
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / RPiMCP23S17-1.0.0-py3-none-any.whl

Download URL RPiMCP23S17-1.0.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89343cbaadc01866da521f32fee1d55a4f0a52fa42091557c7bcec86763b8b36
BLAKE2b-256 checksum
How to use checksums
8e392dfa37e88e21164aab3b737ac3489a89ab3b392af5e698bba212ade5eb0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for RPiMCP23S17 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page