Arduino based digital clock.
https://zzncx.top/posts/digital-clock-part-6/
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
1 year ago | |
---|---|---|
.vscode | 2 years ago | |
include | 2 years ago | |
lib | 2 years ago | |
src | 1 year ago | |
test | 2 years ago | |
.gitignore | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 1 year ago | |
platformio.ini | 1 year ago |
README.md
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) {}