CircuitPython library for passive matrix keypads.
Project description
Introduction
This simple helper library lets you create objects that will scan and detect keypresses on passive matrix keypads
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-matrixkeypad
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-matrixkeypad
To install in a virtual environment in your current project:
mkdir project-name && cd project-name python3 -m venv .env source .env/bin/activate pip3 install adafruit-circuitpython-matrixkeypad
Usage Example
import adafruit_matrixkeypad from digitalio import DigitalInOut import board # Classic 3x4 matrix keypad cols = [DigitalInOut(x) for x in (board.D2, board.D0, board.D4)] rows = [DigitalInOut(x) for x in (board.D1, board.D6, board.D5, board.D3)] keys = ((1, 2, 3), (4, 5, 6), (7, 8, 9), ('*', 0, '#')) keypad = adafruit_matrixkeypad.Matrix_Keypad(rows, cols, keys) while True: keys = keypad.pressed_keys if keys: print("Pressed: ", keys) time.sleep(0.1)
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Documentation
For information on building library documentation, please check out this guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size adafruit-circuitpython-matrixkeypad-1.2.5.tar.gz (26.5 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for adafruit-circuitpython-matrixkeypad-1.2.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 566ae2443dbe031afd218ff1183d88522a376cc6621b6644b8bf52ba56d0940a |
|
MD5 | 0f98dea51cc689bcb59f05eb4c666022 |
|
BLAKE2-256 | f6f0d975b40d7c83314ea4ca6a8f5bfe60c1b94bdc465507e13a2b20dc31b26e |