Cover image
Try Now
2019-03-21

Ce module Python résume le GPIO Expander MCP23S17 pour une utilisation sur le Raspberry Pi.

3 years

Works with Finder

4

Github Watches

11

Github Forks

13

Github Stars

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 <https://pypi.python.org/pypi/RPiMCP23S17>_::

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)

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://appia.in
  • Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • jae-jae
  • MCP Server pour récupérer le contenu de la page Web à l'aide du navigateur sans tête du dramwright.

  • ravitemer
  • Un puissant plugin Neovim pour gérer les serveurs MCP (Protocole de contexte modèle)

  • patruff
  • Pont entre les serveurs Olllama et MCP, permettant aux LLM locaux d'utiliser des outils de protocole de contexte de modèle

  • pontusab
  • La communauté du curseur et de la planche à voile, recherchez des règles et des MCP

  • av
  • Exécutez sans effort LLM Backends, API, Frontends et Services avec une seule commande.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • appcypher
  • Serveurs MCP géniaux - une liste organisée de serveurs de protocole de contexte de modèle

    Reviews

    3 (1)
    Avatar
    user_meQswraE
    2025-04-17

    As a loyal user of the RPi-MCP23S17 by petrockblog, I am incredibly impressed with its performance and ease of use. This GPIO expander has greatly extended the functionality of my Raspberry Pi projects, making it simple to manage additional inputs and outputs. The detailed documentation and active community on GitHub have been invaluable resources. Highly recommend it!