@uci/mcp-switches

0.1.0 • Public • Published

uCOMmandIt MCP Switches

Build Status Inline docs Dependencies devDependencies codecov

What is it?

This module extends the MCP class for setting up multiple banks of MCP chips as switches that have pullups which will trip the MCP interrupt pin (as a pulldown) which is caught by a GPIO set up as an (pulldown) interrupt on the controlling single board computer, SBC (e.g. Raspberry Pi). The module emits a "switch.flipped" event and passes the data of which pin on what chip/bank and port was flipped and it's current state plus the pin id which you may have set previously.

Prerequisites

See the uci-mcp module for details about what hardware you'll need and how to set it up. You'll be using the mcp's interrupt. That means you must solder up a 5V to 3.3V logic level converter from the MCP's interrupt pin to the pin on your SBC's gpio pin. You'll need to make note of the SBC's pin number as that will need to be in the database of switch banks you'll pass to make your instance.

Quickstart

npm install @uci/mcp-switches

edit the demo/switchesDB.js file for your physical hardware setup (can be just a single chip/board)

npm run demo will run as sudo (root privilidges. See mcp-interrupt

Readme

Keywords

Package Sidebar

Install

npm i @uci/mcp-switches

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • dkebler