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: MaxSonar RTC-DS1307 TextLCD mbed
Diff: main.cpp
- Revision:
- 1:aa2b8929a968
- Parent:
- 0:514ef400f75b
- Child:
- 2:d3a3a15016f3
diff -r 514ef400f75b -r aa2b8929a968 main.cpp
--- a/main.cpp Wed May 24 15:56:58 2017 +0000
+++ b/main.cpp Thu May 25 10:42:27 2017 +0000
@@ -3,19 +3,32 @@
#include "Rtc_Ds1307.h"
Rtc_Ds1307 rtc(PTE0, PTE1);
-TextLCD lcd(PTE4, PTE5, PTE20, PTE21, PTE22, PTE23); // rs, e, d4-d7
+DigitalOut r(LED1);
+TextLCD lcd(PTE5, PTE4, PTE3, PTE2, PTB11, PTB10); // rs, e, d4-d7
Serial pc(USBTX, USBRX);
+Rtc_Ds1307::Time_rtc tim = {};
+
+void displayTime();
int main() {
- Rtc_Ds1307::Time_rtc tm = {};
- rtc.startClock();
+ Ticker cloo;
+ rtc.startClock();
+
+ cloo.attach(&displayTime, 1);
- while(1) {
- if (rtc.getTime(tm) ) {
+ while(1){
+ r = !r;
+ wait(0.2);
+ }
+}
+
+void displayTime(){
+
+ Rtc_Ds1307::Time_rtc tm = tim;
+
+ if (rtc.getTime(tm) ) {
+ lcd.cls();
lcd.printf("The time is :\n%02d:%02d:%02d", tm.hour, tm.min, tm.sec);
}
- wait(1);
- lcd.cls();
- }
-}
\ No newline at end of file
+ }
\ No newline at end of file