Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed TM1636 RTC-DS1307
Revision 4:051852f988eb, committed 2018-12-18
- Comitter:
- jobtanadol
- Date:
- Tue Dec 18 09:34:52 2018 +0000
- Parent:
- 3:3d8968877eee
- Commit message:
- hi
Changed in this revision
| TM1636.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TM1636.lib Tue Dec 18 09:34:52 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/rogerzuber/code/TM1636/#e4450fb0849a
--- a/main.cpp Mon Dec 17 06:40:00 2018 +0000
+++ b/main.cpp Tue Dec 18 09:34:52 2018 +0000
@@ -1,16 +1,20 @@
#include "mbed.h"
#include "Rtc_Ds1307.h"
+#include "TM1636.h"
//RtcCls rtc(p28, p27, p29, true);
-Rtc_Ds1307 rtc(D14, D15);
-DigitalIn button_K1(A5);
+Rtc_Ds1307 rtc(D3, D6);
+DigitalIn button_K3(A5);
+TM1636 tm1636(D7,D8);
Serial pc(USBTX, USBRX, "pc");
-char buffer[128];
-int readptr = 0;
+//char buffer[128];
+//int readptr = 0;
int main() {
- button_K1.mode(PullUp);
+int8_t temp[4];
+ button_K3.mode(PullUp);
+ tm1636.init();
Rtc_Ds1307::Time_rtc tm = {};
tm.date = 1 ;
tm.mon = 1 ;
@@ -21,14 +25,15 @@
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();
+ rtc.getTime(tm);
+ pc.printf("%02d:%02d:%02d\n",tm.hour,tm.min,tm.sec);
+ temp[0] = tm.hour / 10;
+ temp[1] = tm.hour % 10;
+ temp[2] = tm.min / 10;
+ temp[3] = tm.min % 10;
+ tm1636.display(temp);
+
}
}
\ No newline at end of file