33 #include "utility/LiquidCrystal.h"
36 #define LCD_BUTTON_NONE 0
37 #define LCD_BUTTON_LEFT 1
38 #define LCD_BUTTON_RIGHT 2
39 #define LCD_BUTTON_UP 3
40 #define LCD_BUTTON_DOWN 4
41 #define LCD_BUTTON_SELECT 5
42 #define LCD_BUTTON_LEFT_RELEASED -1
43 #define LCD_BUTTON_RIGHT_RELEASED -2
44 #define LCD_BUTTON_UP_RELEASED -3
45 #define LCD_BUTTON_DOWN_RELEASED -4
46 #define LCD_BUTTON_SELECT_RELEASED -5
48 class LCD :
public LiquidCrystal {
50 LCD() : LiquidCrystal(8, 9, 4, 5, 6, 7) { init(); }
51 LCD(uint8_t pin9) : LiquidCrystal(8, pin9, 4, 5, 6, 7) { init(); }
52 LCD(uint8_t rs, uint8_t enable,
53 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
54 : LiquidCrystal(rs, enable, d0, d1, d2, d3) { init(); }
79 uint8_t _backlightPin;
83 unsigned long timeout;
84 unsigned long lastRestore;
85 unsigned long lastDebounce;
void setScreenSaverMode(ScreenSaverMode mode)
Sets the current screen saver mode.
int getButton()
Gets the next button press, release, or idle event.
Same as BacklightOff but the screen saver is only deactivated when Select is pressed; other buttons h...
ScreenSaverMode
Screen saver mode that controls the display and back light.
LCD(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
Initialize the Freetronics LCD display with custom pins.
Turn off the back light but leave the display on when the screen saver is activated.
void setBacklightPin(uint8_t pin)
Sets the back light pin for the LCD shield.
LCD()
Initialize the Freetronics LCD display with the default pin assignment.
void enableScreenSaver(int timeoutSecs=10)
Enables the screen saver and causes it to activate after timeoutSecs of inactivity on the buttons...
LCD(uint8_t pin9)
Initialize the Freetronics LCD display for USBDroid.
void noDisplay()
Turns off the display of text on the LCD and the back light.
Turn off both the display and the backlight when the screen saver is activated.
void disableScreenSaver()
Disables the screen saver.
void display()
Turns on the display of text on the LCD and the back light.
uint8_t backlightPin() const
Returns the pin that is being used to control the back light. The default is 3.
Enhanced library for Freetronics 16x2 LCD shields.
bool isScreenSaved() const
Returns true if the screen has been saved; false otherwise.
ScreenSaverMode screenSaverMode() const
Returns the current screen saver mode; default is DisplayOff.