Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Interrupt-based matrix keypad library for Raspberry Pi

Project Description

pad4pi

An interrupt-based Python 2/3 library for reading matrix keypad key presses using Raspberry Pi GPIO pins.

pip install pad4pi

Tested on a Raspberry Pi B+ using a 4x3 matrix keypad but it should work with 4x4 and other sizes.

Usage

from pad4pi import rpi_gpio

KEYPAD = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9],
    ["*", 0, "#"]
]

ROW_PINS = [4, 14, 15, 17] # BCM numbering
COL_PINS = [18, 27, 22] # BCM numbering

factory = rpi_gpio.KeypadFactory()

# Try factory.create_4_by_3_keypad
# and factory.create_4_by_4_keypad for reasonable defaults
keypad = factory.create_keypad(keypad=KEYPAD, row_pins=ROW_PINS, col_pins=COL_PINS)

def printKey(key):
    print(key)

# printKey will be called each time a keypad button is pressed
keypad.registerKeyPressHandler(printKey)

When your program exits, call keypad.cleanup() to ensure the Raspberry Pi’s GPIO pins are reset.

License

Licensed under GNU Lesser General Public License Version 3 (LGPL v3).

Release History

Release History

This version
History Node

1.1.2

History Node

1.1.1

History Node

1.1.0

History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pad4pi-1.1.2.tar.gz (2.9 kB) Copy SHA256 Checksum SHA256 Source Oct 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting