Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konstantinfarrell/f8e09077a970851e7085872fa19b4189 to your computer and use it in GitHub Desktop.
Save konstantinfarrell/f8e09077a970851e7085872fa19b4189 to your computer and use it in GitHub Desktop.
A bare-minimum example of how to work with an LCD Keypad Shield from DF Robot for Arduino.
/*
* Basic example code for working with an LCD Keypad Shield
* from DF Robot and an Arduino Uno.
* Written by: Konstantin Farrell
*/
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
int readkey;
void setup() {
lcd.begin(16, 2);
}
void loop() {
lcd.setCursor(0, 1);
readkey=analogRead(0);
if (readkey==0) {
lcd.clear();
lcd.print("Button Right");
}
else if(readkey==98) {
lcd.clear();
lcd.print("Button Up");
}
else if(readkey==254) {
lcd.clear();
lcd.print("Button Down");
}
else if(readkey==407) {
lcd.clear();
lcd.print("Button Left");
}
else if(readkey==637) {
lcd.clear();
lcd.print("Button Select");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment