I am at a very rudimentary stage of a menu I'd like to develop for an LCD screen and keypad. For the time being, I'm using Serial.println instead of LCD. My first goal is just to be able to have different screens pop up when different numbers are entered on the keypad. So far nothing is printing to the serial monitor. I feel like it has something to do with "key." Thanks for your help.
int menu = 0;
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys [ROWS][COLS] = {
{
'1','2','3','A' }
,
{
'4','5','6','B' }
,
{
'7','8','9','C' }
,
{
'*','0','#','D' }
};
byte rowPins[ROWS] = {
9,8,7,6};
byte colPins[COLS] = {
5, 4, 3, 2};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin (9600);
}
void loop(){
char key = keypad.getKey();
if ( key == 1){
Serial.println("Total Time");
}
if ( key == 2){
Serial.println("Total Pan");
}
if ( key == 3){
Serial.println("Total Tilt");
}
}