![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
hi
Dependencies: mbed TM1636 RTC-DS1307
main.cpp@4:051852f988eb, 2018-12-18 (annotated)
- Committer:
- jobtanadol
- Date:
- Tue Dec 18 09:34:52 2018 +0000
- Revision:
- 4:051852f988eb
- Parent:
- 3:3d8968877eee
- Child:
- 5:c1f6194ed8bd
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" |
jobtanadol | 4:051852f988eb | 3 | #include "TM1636.h" |
leihen | 0:431183c5b136 | 4 | |
leihen | 2:3be003301107 | 5 | //RtcCls rtc(p28, p27, p29, true); |
jobtanadol | 4:051852f988eb | 6 | Rtc_Ds1307 rtc(D3, D6); |
jobtanadol | 4:051852f988eb | 7 | DigitalIn button_K3(A5); |
jobtanadol | 4:051852f988eb | 8 | TM1636 tm1636(D7,D8); |
leihen | 0:431183c5b136 | 9 | Serial pc(USBTX, USBRX, "pc"); |
leihen | 0:431183c5b136 | 10 | |
jobtanadol | 4:051852f988eb | 11 | //char buffer[128]; |
jobtanadol | 4:051852f988eb | 12 | //int readptr = 0; |
leihen | 1:6dbe51fe0737 | 13 | |
leihen | 0:431183c5b136 | 14 | int main() { |
jobtanadol | 4:051852f988eb | 15 | int8_t temp[4]; |
jobtanadol | 4:051852f988eb | 16 | button_K3.mode(PullUp); |
jobtanadol | 4:051852f988eb | 17 | tm1636.init(); |
leihen | 2:3be003301107 | 18 | Rtc_Ds1307::Time_rtc tm = {}; |
jobtanadol | 3:3d8968877eee | 19 | tm.date = 1 ; |
jobtanadol | 3:3d8968877eee | 20 | tm.mon = 1 ; |
jobtanadol | 3:3d8968877eee | 21 | tm.year = 12 ; |
jobtanadol | 3:3d8968877eee | 22 | tm.hour = 0; |
jobtanadol | 3:3d8968877eee | 23 | tm.min = 0; |
jobtanadol | 3:3d8968877eee | 24 | tm.sec = 0; |
jobtanadol | 3:3d8968877eee | 25 | rtc.setTime(tm, false, false); |
jobtanadol | 3:3d8968877eee | 26 | rtc.startClock(); |
leihen | 0:431183c5b136 | 27 | while(1) { |
leihen | 0:431183c5b136 | 28 | |
jobtanadol | 4:051852f988eb | 29 | rtc.getTime(tm); |
jobtanadol | 4:051852f988eb | 30 | pc.printf("%02d:%02d:%02d\n",tm.hour,tm.min,tm.sec); |
jobtanadol | 4:051852f988eb | 31 | temp[0] = tm.hour / 10; |
jobtanadol | 4:051852f988eb | 32 | temp[1] = tm.hour % 10; |
jobtanadol | 4:051852f988eb | 33 | temp[2] = tm.min / 10; |
jobtanadol | 4:051852f988eb | 34 | temp[3] = tm.min % 10; |
jobtanadol | 4:051852f988eb | 35 | tm1636.display(temp); |
jobtanadol | 4:051852f988eb | 36 | |
jobtanadol | 3:3d8968877eee | 37 | } |
jobtanadol | 3:3d8968877eee | 38 | } |
jobtanadol | 3:3d8968877eee | 39 |