Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PerfecXX/MicroPython-SimpleKeypad
MicroPython library for interfacing with a keypad matrix
https://github.com/PerfecXX/MicroPython-SimpleKeypad
4x4-keypad esp32 keypad keypad-matrix micropython micropython-esp32
Last synced: about 1 month ago
JSON representation
MicroPython library for interfacing with a keypad matrix
- Host: GitHub
- URL: https://github.com/PerfecXX/MicroPython-SimpleKeypad
- Owner: PerfecXX
- License: mit
- Created: 2024-02-07T02:18:10.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-07T02:48:37.000Z (11 months ago)
- Last Synced: 2024-10-15T18:40:19.034Z (2 months ago)
- Topics: 4x4-keypad, esp32, keypad, keypad-matrix, micropython, micropython-esp32
- Language: Python
- Homepage: https://pypi.org/project/micropython-simple-keypad/
- Size: 122 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-micropython - MicroPython-SimpleKeypad - MicroPython library for interfacing with a keypad matrix. (Libraries / IO)
README
# MicroPython Simple Keypad
![MicroPython](https://img.shields.io/badge/MicroPython-Ready-brightgreen.svg)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)MicroPython library for interfacing with a keypad matrix
![](https://github.com/PerfecXX/MicroPython-SimpleKeypad/blob/main/doc/4x4keypad.png)
## 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.
```python
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
```