Arduino based digital clock. https://zzncx.top/posts/digital-clock-part-6/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Joshua R. T. Purba 3699722e31 Update link and pictures 4 months ago
.vscode Digital clock with Arduino Pro Mini 6 months ago
include Digital clock with Arduino Pro Mini 6 months ago
lib Digital clock with Arduino Pro Mini 6 months ago
src Use Low-Power library and remove Analog Buttons library. 4 months ago
test Digital clock with Arduino Pro Mini 6 months ago
.gitignore Digital clock with Arduino Pro Mini 6 months ago
LICENSE Digital clock with Arduino Pro Mini 6 months ago
README.md Update link and pictures 4 months ago
platformio.ini Use Low-Power library and remove Analog Buttons library. 4 months ago

README.md

Digital Clock

Arduino based digital clock.

Breadboarded project Breadboard diagram Electronics schematic

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 = &currentMenuTable[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 = &currentMenuTable[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) {}