Lehrer Busch
/
xxx_Uhr_I2C_LCD_Delay_BuaV
xxx_Uhr_I2C_LCD_Delay_Bua
Diff: main.cpp
- Revision:
- 0:c1a408e17600
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 23 19:23:05 2022 +0000 @@ -0,0 +1,60 @@ +/* mbed BuschA, */ +#include "mbed.h" +#include "UP_Uhr.c" +#include "LCD.h" +#include "I2C_LCD_Ausgabe.h" + + +// Set the LCD address to 0x27 for a 16 chars and 2 line display + +lcd mylcd; + +int sec, minu, stud; + +void Ausgabe_LCD (void) +{ + mylcd.cursorpos(0x00); + mylcd.printf(" Uhrzeit:"); + mylcd.cursorpos(0x40); + mylcd.printf(" %2d h: m:%2d s:%2d ",stud, minu, sec); +} + + +void Uhr (void) +{ + sec = sec + 1; + if (sec == 60) + { + minu ++; + sec = 0; + + if (minu == 60) + { + stud ++; + minu = 0; + + if (stud == 24) + { + stud = 0; + } + } + } + } + +int main() +{ + mylcd.clear(); + + + while (true) + { + + { + Uhr(); + Ausgabe_LCD(); + thread_sleep_for(1000); //Sleep = Warten... + } + } +} + +