Advertisement
Braulio777

Arduino LCD Using The Buttons-Right, Left. Up, Down, & Reset

Nov 23rd, 2014
386
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Arduino LCD Using Buttons-Right, Left, Up, Down, & Reset
  2. #include <LiquidCrystal.h>
  3. LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);
  4. int readkey;
  5. void setup()  {
  6.   lcd.begin(16, 2);
  7.   lcd.print("CLUB JAMECO");
  8. }
  9. void loop() {
  10.   lcd.setCursor(0, 1);
  11.   lcd.print("ARDUINO LCD");
  12.   readkey=analogRead(0);
  13.   if (readkey<50) {
  14.   lcd.clear();
  15.   lcd.print("Button Right");
  16.   }
  17.   else if(readkey<195) {
  18.     lcd.clear();
  19.     lcd.print("Button Up");
  20.   }
  21.   else if(readkey<380) {
  22.     lcd.clear();
  23.     lcd.print("Button Down");
  24.   }
  25.   else if(readkey<790) {
  26.     lcd.clear();
  27.     lcd.print("Button Left");
  28.   }
  29. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement