![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
hi
Dependencies: mbed TM1636 RTC-DS1307
main.cpp@3:3d8968877eee, 2018-12-17 (annotated)
- Committer:
- jobtanadol
- Date:
- Mon Dec 17 06:40:00 2018 +0000
- Revision:
- 3:3d8968877eee
- Parent:
- 2:3be003301107
- Child:
- 4:051852f988eb
hi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
leihen | 0:431183c5b136 | 1 | #include "mbed.h" |
leihen | 0:431183c5b136 | 2 | #include "Rtc_Ds1307.h" |
leihen | 0:431183c5b136 | 3 | |
leihen | 2:3be003301107 | 4 | //RtcCls rtc(p28, p27, p29, true); |
jobtanadol | 3:3d8968877eee | 5 | Rtc_Ds1307 rtc(D14, D15); |
jobtanadol | 3:3d8968877eee | 6 | DigitalIn button_K1(A5); |
leihen | 0:431183c5b136 | 7 | Serial pc(USBTX, USBRX, "pc"); |
leihen | 0:431183c5b136 | 8 | |
leihen | 0:431183c5b136 | 9 | char buffer[128]; |
leihen | 0:431183c5b136 | 10 | int readptr = 0; |
leihen | 1:6dbe51fe0737 | 11 | |
leihen | 0:431183c5b136 | 12 | int main() { |
jobtanadol | 3:3d8968877eee | 13 | button_K1.mode(PullUp); |
leihen | 2:3be003301107 | 14 | Rtc_Ds1307::Time_rtc tm = {}; |
jobtanadol | 3:3d8968877eee | 15 | tm.date = 1 ; |
jobtanadol | 3:3d8968877eee | 16 | tm.mon = 1 ; |
jobtanadol | 3:3d8968877eee | 17 | tm.year = 12 ; |
jobtanadol | 3:3d8968877eee | 18 | tm.hour = 0; |
jobtanadol | 3:3d8968877eee | 19 | tm.min = 0; |
jobtanadol | 3:3d8968877eee | 20 | tm.sec = 0; |
jobtanadol | 3:3d8968877eee | 21 | rtc.setTime(tm, false, false); |
jobtanadol | 3:3d8968877eee | 22 | rtc.startClock(); |
leihen | 0:431183c5b136 | 23 | while(1) { |
jobtanadol | 3:3d8968877eee | 24 | if(!button_K1){ |
jobtanadol | 3:3d8968877eee | 25 | rtc.getTime(tm); |
jobtanadol | 3:3d8968877eee | 26 | pc.printf("%02d:%02d:%02d\n",tm.hour,tm.min,tm.sec); |
jobtanadol | 3:3d8968877eee | 27 | wait(0.3); |
jobtanadol | 3:3d8968877eee | 28 | } |
jobtanadol | 3:3d8968877eee | 29 | |
leihen | 0:431183c5b136 | 30 | |
jobtanadol | 3:3d8968877eee | 31 | //rtc.stopClock(); |
jobtanadol | 3:3d8968877eee | 32 | } |
jobtanadol | 3:3d8968877eee | 33 | } |
jobtanadol | 3:3d8968877eee | 34 |