Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5368

General discussion • Pi 5 and 4 x 4 Keypad

$
0
0
Hi.

If anyone could point me in the right direction, i really would be grateful.

I have purchased a Pi 5 and 4 x 4 matrix keypad. For testing purposes i have just 1 wire connected from the keypad to the Pi, for simplicity.

The kaypad has 10 connections, but as i understand it, the far left and right are not to be used.

I know that the default GPIO libary does not work on Pi 5, so i have been trying to use GPIOZero.

I cannot get any response from the keypad what so ever. Below is the code i have been using.

from gpiozero import Button
from signal import pause

# Initialize the button for pin 1 on the keypad connected to GPIO 17 with pull-up resistor
keypad_pin = Button(17, pull_up=True)

# Function to handle button press
def on_key_press():
print("Key pressed on GPIO 17")

# Assign the button press event handler
keypad_pin.when_pressed = on_key_press

try:
print("Press the key connected to GPIO 17:")
pause()
except KeyboardInterrupt:
print("\nProgram exited cleanly.")
finally:
keypad_pin.close()


Thank you for any help i cant get.

Statistics: Posted by CraftyPanda — Sat Jun 01, 2024 11:28 pm



Viewing all articles
Browse latest Browse all 5368

Trending Articles