LCD Keypad Shield
White Char Blue Background LCD 5 buttons with a Reset Pin Analogue 0 (select, up, down, right, left) very useful for menus / games
- Code
- Questions & Answers
- Specifications
intermediate LCD Keypad Shield Test
The direction and select buttons are all connected to pin A0 via a resistor network. The 16 x 2 LCD display uses the typical pinout.
/* Simple Keypad Shield Test */ #include <LiquidCrystal.h> //LCD pin to Arduino const int RSpin = 8; const int ENpin = 9; const int d4pin = 4; const int d5pin = 5; const int d6pin = 6; const int d7pin = 7; const int BackLight = 10; LiquidCrystal lcd( RSpin, ENpin, d4pin, d5pin, d6pin, d7pin); void setup() { lcd.clear(); lcd.begin(16, 2); lcd.setCursor(0,0); lcd.print("Automation Bros"); lcd.setCursor(0,1); lcd.print("Key: "); } void loop() { int x; x = analogRead (0); lcd.setCursor(10,1); if (x < 60) { lcd.print ("Right "); } else if (x < 200) { lcd.print ("Up "); } else if (x < 400){ lcd.print ("Down "); } else if (x < 600){ lcd.print ("Left "); } else if (x < 800){ lcd.print ("Select"); } }