xxx_Uhr_I2C_LCD_Delay_Bua

Dependencies:   LCD_i2C_JDS

main.cpp

Committer:
itbusch
Date:
2022-02-23
Revision:
0:c1a408e17600

File content as of revision 0:c1a408e17600:

/* 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...
            }
    }
}