Go Down

Topic: Onewirekeypad (Read 227 times) previous topic - next topic


Aug 09, 2016, 06:59 am Last Edit: Aug 09, 2016, 07:06 am by frank1293
Hey all,

I have created my voltage divider for the 4x3 matrix keypad with use of the arduino uno to allow it to use only one analogue pin . Is there any other sample code to output the keypad press onto the serial ? or is that what (Event Key) is meant to do as im not too sure. The only thing running this code gives me is "This is a test" upon pressing the hash key

any help would be awesome cheers

Code: [Select]
//Original Creator: Andrew Mascolo

#include <OnewireKeypad.h>

char KEYS[]= {

OnewireKeypad <Print, 12 > Keypad(Serial, KEYS, 4, 3, A15, 4700, 1000 );

void setup ()
  Keypad.addEventKey(test, '#'); // Add Function to list | Key to look for
  Keypad.addEventKey(togglePin13, '*');

void loop()
  Keypad.ListenforEventKey(); // check if an EventKey is found

void test()
  Serial.println("This is a test");
  Keypad.deleteEventKey('#'); // remove function from list

void togglePin13()


Aug 09, 2016, 08:30 am Last Edit: Aug 09, 2016, 08:31 am by OldSteve
Doesn't it also toggle the onboard LED when '*' is pressed?

I haven't used this method of reading a keypad, but it looks to me like 'getKey()' will return the value of the latest keypress, and probably 0 if there isn't one in the buffer.

Have you tried something like:-
Code: [Select]
char c = getKey();
if(c > 0)


Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

Go Up