hi

Dependencies:   mbed TM1636 RTC-DS1307

main.cpp

Committer:
jobtanadol
Date:
2018-12-17
Revision:
3:3d8968877eee
Parent:
2:3be003301107
Child:
4:051852f988eb

File content as of revision 3:3d8968877eee:

#include "mbed.h"
#include "Rtc_Ds1307.h"

//RtcCls rtc(p28, p27, p29, true);
Rtc_Ds1307 rtc(D14, D15);
DigitalIn  button_K1(A5);
Serial pc(USBTX, USBRX, "pc");

char buffer[128];
int readptr = 0;

int main() {
    button_K1.mode(PullUp);
    Rtc_Ds1307::Time_rtc tm = {};
    tm.date = 1 ;
    tm.mon = 1 ;
    tm.year = 12 ;
    tm.hour = 0;
    tm.min = 0;
    tm.sec = 0;
    rtc.setTime(tm, false, false);
    rtc.startClock();
    while(1) {
       if(!button_K1){
           rtc.getTime(tm);
           pc.printf("%02d:%02d:%02d\n",tm.hour,tm.min,tm.sec);
           wait(0.3);
           }
       
            
            //rtc.stopClock();
            }
            }