Onewirekeypad

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

//Original Creator: Andrew Mascolo

#include <OnewireKeypad.h>

char KEYS[]= {
  '1','2','3',
  '4','5','6',
  '7','8','9',
  '*','0','#',
};

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

void setup ()
{
  Serial.begin(115200);
  pinMode(13,OUTPUT);
  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()
{
  digitalWrite(13,!digitalRead(13));
}

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:-

char c = getKey();
if(c > 0)
    Serial.println(c);

OneWireKeyPad