http://www.hobbytronics.co.uk/arduino-lcd-keypad-shield
This is a 16x2 LCD and Keypad shield for Arduino Uno, Diecimila, Duemilanove, Freeduino boards, and other Uno sized compatible boards such as the Sparkfun Redboard.
Blue Backlight with white words | |
uses 4 Bit Arduino LCD Library | |
Left, Right, Up, Down and Select buttons | |
Screen contrast adjustment | |
Arduino Reset button |
The board uses different pins to the Arduino example sketches, so to make the display work, use the following sequence of pins when starting the library:
LiquidCrystal
lcd(8,9,4,5,6,7);
The buttons are connected to only one analog input pin through resistors to give a different voltage for each button, thus saving on input/output pins. Reading the buttons is easy and example code is shown below
Pin Connections
Pin | Function |
Analog 0 | Buttons (select, up, right, down and left) |
Digital 4 | DB4 |
Digital 5 | DB5 |
Digital 6 | DB6 |
Digital 7 | DB7 |
Digital 8 | RS (Data or Signal Display Selection) |
Digital 9 | Enable |
Note: Do not use pin Digital 10 when this board is plugged in (see here for more details)
The
backlight is not dimmable by default. In order to make it dimmable using
PWM see this instructable
www.instructables.com/id/Arduino-LCD-Backlight-Fix/
The board is a little bigger than an Arduino UNO (measuring 8cm x 6cm). This can be seen in the images.
Montage
Arduino UNO + carte qui depasse
L arduino lit les voltages pour chaque bouton on en deduit le bouton dans une boucle condition
E100
A 640 B 410 C 0 RESET
F257
// include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0,0); lcd.print("LCD Key Shield"); lcd.setCursor(0,1); lcd.print("Press 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"); } }
------------------
programme pur lire le voltage
// include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.setCursor(0,0); lcd.print(" "); lcd.setCursor(0,1); lcd.print("Press Key:"); } void loop() { int x; x = analogRead (0); lcd.setCursor(0,0); lcd.print(" "); lcd.setCursor(0,0); lcd.print (x); lcd.setCursor(10,1); delay(500); 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 ("Ext Left"); } }