Arduino-LCD
LCD library for Arduino
Keypad.ino
Go to the documentation of this file.
1 #include "GPIO.h"
2 #include "LCD.h"
3 #include "Shield/LCD_Keypad.h"
4 #include "Shield/LCD4884.h"
5 
6 // Configure: LCD4884 or LCD_Keypad Shield
8 // LCD_Keypad lcd;
9 
10 void setup()
11 {
12  lcd.begin();
13  lcd.print(F("Keypad: started"));
14 }
15 
16 void loop()
17 {
18  // Check that a key pad change
19  if (!lcd.ischanged()) return;
20 
21  // Print the key name
22  lcd.display_clear();
23  switch (lcd.key()) {
24  case lcd.NO_KEY:
25  lcd.print(F("NO_KEY"));
26  break;
27  case lcd.SELECT_KEY:
28  lcd.print(F("SELECT_KEY"));
29  break;
30  case lcd.LEFT_KEY:
31  lcd.print(F("LEFT_KEY"));
32  break;
33  case lcd.DOWN_KEY:
34  lcd.print(F("DOWN_KEY"));
35  break;
36  case lcd.UP_KEY:
37  lcd.print(F("UP_KEY"));
38  break;
39  case lcd.RIGHT_KEY:
40  lcd.print(F("RIGHT_KEY"));
41  break;
42  default:
43  lcd.print(lcd.key());
44  }
45 
46  // Print key number and timestamp when pressed
47  lcd.cursor_set(0, 1);
48  lcd.print(lcd.key());
49  lcd.print(':');
50  lcd.print(lcd.timestamp());
51 }
virtual void display_clear()
Definition: PCD8544.h:273
virtual void cursor_set(uint8_t x, uint8_t y)
Definition: PCD8544.h:286
LCD4884 lcd
Definition: Keypad.ino:7
virtual bool begin()
Definition: LCD4884.h:64
void loop()
Definition: Keypad.ino:16
void setup()
Definition: Keypad.ino:10