Freenove / Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi

Apply to FNK0020
Other
561 stars 294 forks source link

C code, Project 20.1 I2C LCD1602, time is displayed incorrectly #20

Closed kurl closed 4 years ago

kurl commented 4 years ago

For the C code, Project 20, I2C LCD1602, the time is displayed incorrectly.

localtime() returns a struct where seconds, minutes and hours can be a single digit if the value is less than 10.

int tm_sec;         /* seconds,  range 0 to 59          */
int tm_min;         /* minutes, range 0 to 59           */
int tm_hour;        /* hours, range 0 to 23             */

When ticking, the LCD do not reset itself and displays a wrong time when passing over a minute.

eg: 
23:15:58
23:15:59
23:16:19
23:16:29
...
23:16:99
23:16:10
23:16:11