Skip to main content

CircuitPython library for passive matrix keypads.

Project description

Introduction

Documentation Status Discord Build Status Code Style: Black

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 .venv
source .venv/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)

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

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

Built Distribution

File details

Details for the file adafruit-circuitpython-matrixkeypad-1.2.10.tar.gz.

File metadata

File hashes

Hashes for adafruit-circuitpython-matrixkeypad-1.2.10.tar.gz
Algorithm Hash digest
SHA256 6fe789d3ec88f5d65469e5c4d8ab53076390cc5a95bb0149b9c5a77e42fcd4a1
MD5 96671a7094ccd057fb6a2adc8a2789da
BLAKE2b-256 2410a8ae84b79cc6f1e24c832ead33f7606e05d7a3b541e0fc05421c6b53b770

See more details on using hashes here.

File details

Details for the file adafruit_circuitpython_matrixkeypad-1.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for adafruit_circuitpython_matrixkeypad-1.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 85b3d710c77c1f9889fb4576ccbf74555e4ede1661dc0f0fbd799958c6d0b506
MD5 d9ef859037c0cc563fb306264df1f54a
BLAKE2b-256 a5d67edba0b7856bc3e699dd681bc74104a4e78b606209582a05c687cba4b107

See more details on using hashes here.

Supported by

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