ArduinoKeypad

This program has been tested on the Arduino UNO R3. When a button is pressed on the LCD Plus Shield keypad, the result is displayed in the Arduino Serial Monitor program.

Arduino Code

int analogPin = A0;                        
int val = 0;         

void setup()
{
  // setup serial
  Serial.begin(9600);          
  Serial.println("Press a key...");
}

void loop()
{
  // read the input pin
  val = analogRead(analogPin);    

  // now display the result...
  if (val == 0) {
     Serial.println("SELECT");
  }
  else if (val <= 200) {
     Serial.println("BOTTOM");
  }
  else if (val <= 300) {
     Serial.println("RIGHT");
  }
  else if (val <= 400) {
     Serial.println("TOP");
  }
  else if (val <= 500) {
     Serial.println("LEFT");
  }
  delay(500);
}