Created
May 11, 2016 04:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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