2.8 KiB
2.8 KiB
Digital Clock
Arduino based digital clock.
Compiling
To be able to compile this, you need to modify the LcdMenu library. Edit the LcdMenu.h file from the LcdMenu library, find this:
/**
* Toggle backlight
*/
void toggleBacklight() {
MenuItem* item = ¤tMenuTable[cursorPosition];
if (item->getType() == MENU_ITEM_TOGGLE) {
lcd->setBacklight(item->isOn);
}
}
Replace it to this:
/**
* Toggle backlight
*/
void toggleBacklight() {
#ifndef USE_STANDARD_LCD
MenuItem* item = ¤tMenuTable[cursorPosition];
if (item->getType() == MENU_ITEM_TOGGLE) {
lcd->setBacklight(item->isOn);
}
#endif
}
Other than that, if you get warnings like this:
src/main.cpp:71:53: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
ItemToggle("Alarm", "Yes", "No", cbMenuToggleAlarm),
^
src/main.cpp:71:53: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
You can make the warning go away by modifying the the LcdMenu library. Edit the MenuItem.h file from the LcdMenu library,find this:
/**
* @param key key of the item
* @param textOn display text when ON
* @param textOff display text when OFF
* @param callback reference to callback function
*/
ItemToggle(const char* key, char* textOn, char* textOff, fptrInt callback)
: MenuItem(key, textOn, textOff, callback, MENU_ITEM_TOGGLE) {}
Replace it to this:
/**
* @param key key of the item
* @param textOn display text when ON
* @param textOff display text when OFF
* @param callback reference to callback function
*/
ItemToggle(const char* key, const char* textOn, const char* textOff, fptrInt callback)
: MenuItem(key, textOn, textOff, callback, MENU_ITEM_TOGGLE) {}