Skip to main content

MicroPython library for interfacing with a keypad matrix

Project description

MicroPython License

MicroPython library for interfacing with a keypad matrix

Feature

  • Supports any keypad matrix configuration.

  • Easily customizable for different keypad layouts.

  • Provides exception handling for error management.

Example Usage

Example for 4x4 keypad metrix on MicroPython esp32.

from machine import Pin
from keypad import Keypad
from time import sleep

# Define GPIO pins for rows
row_pins = [Pin(25),Pin(26),Pin(27),Pin(14)]

# Define GPIO pins for columns
column_pins = [Pin(23),Pin(22),Pin(19),Pin(18)]

# Define keypad layout
keys = [
    ['1', '2', '3', 'A'],
    ['4', '5', '6', 'B'],
    ['7', '8', '9', 'C'],
    ['*', '0', '#', 'D']]

keypad = Keypad(row_pins, column_pins, keys)

while True:
    key_pressed = keypad.read_keypad()
    if key_pressed:
        print("Key pressed:", key_pressed)
    sleep(0.1)  # debounce and delay

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

micropython-simple-keypad-1.0.3.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file micropython-simple-keypad-1.0.3.tar.gz.

File metadata

File hashes

Hashes for micropython-simple-keypad-1.0.3.tar.gz
Algorithm Hash digest
SHA256 96007d51efa91b3c7c838953326ddfd4dad9a53cf77ec6acd09f38c3ea776ac6
MD5 453ce974b02b7f90f78b9c02b04fd8c9
BLAKE2b-256 0e498e665e0c89488e72bd6e0826b2d05ff64ed00cf8db84a3dd925afd20c55e

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