Update link and pictures

main
Joshua R. T. Purba 2022-02-07 03:47:49 +07:00
parent 0f38115399
commit 3699722e31
1 changed files with 36 additions and 5 deletions

View File

@ -1,14 +1,14 @@
# [Digital Clock](https://zzncx.top/posts/digital-clock-part-5/)
# [Digital Clock](https://zzncx.top/posts/digital-clock-part-6/)
Arduino based digital clock.
[![Breadboarded project](https://zzncx.top/posts/digital-clock-part-5/tidy-regless-promini-sideway-thumb.jpg)](https://zzncx.top/posts/digital-clock-part-5/tidy-regless-promini-sideway.jpg)
[![Breadboard diagram](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_bb-thumb.png)](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_bb.png)
[![Electronics schematic](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_schem-thumb.png)](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_schem.png)
[![Breadboarded project](https://zzncx.top/posts/digital-clock-part-6/running-without-wallwart-thumb.jpg)](https://zzncx.top/posts/digital-clock-part-6/running-without-wallwart.jpg)
[![Breadboard diagram](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_bb-thumb.png)](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_bb.png)
[![Electronics schematic](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_schem-thumb.png)](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_schem.png)
## Compiling
To be able to compile this, you need to modify the [LcdMenu](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [LcdMenu.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/LcdMenu.h#L767-L775) from the LcdMenu library, find this:
To be able to compile this, you need to modify the [LcdMenu](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [LcdMenu.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/LcdMenu.h#L767-L775) file from the LcdMenu library, find this:
```cpp
/**
* Toggle backlight
@ -34,3 +34,34 @@ Replace it to this:
#endif
}
```
Other than that, if you get warnings like this:
```plaintext
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](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [MenuItem.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/MenuItem.h#L306-L313) file from the LcdMenu library,find this:
```cpp
/**
* @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:
```cpp
/**
* @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) {}
```