1

I am still learning about Circuitpython and I have trouble working with a keypad. So I have a Feather M4 Express board(FM4E) and (1x4) Matrix keypad. The (1x4) Matrix keypad has 5 pins where I think four pins are for the numbers on the keypad (1 till 4) and the fifth pin is connected to the power. (FM4E image, keypad image) So I connected all four pins to pin A0, A1, A2, and A3 on the FM4E board. I want to read the keys pressed on the keypad and I am unable to do so. I tried testing the keypad by using if statements and print the number if each button is pressed.

I noticed that it prints multiple times if press one button and sometimes it overlaps with the other keys. For example, I press '2' on the keypad, it prints '2' and'3'.

Is there a better approach to read the key once when the one button on the keypad is pressed?

Thanks! Much appreciated

belle
  • 11
  • 1

1 Answers1

0

I don't know about the issues with button 3 being registered when you're pressing button 2. But when it comes to the multiple times it has to do with the buttons not being perfect switches. Whenever you press a button it actually actuates a bunch of times (basically bouncing before the connection is set).

There seems to be a debouncing library for circuit python that you could try out.

Happy hacking!

Daniel Figueroa
  • 10,348
  • 5
  • 44
  • 66