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
Fork of zProject_RTC_display_alarm by
Diff: main.cpp
- Revision:
- 0:b2064b3558b6
- Child:
- 1:ba7154d2d7ca
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Dec 05 10:02:26 2015 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "DS1307.h"
+#include "DigitDisplay.h"
+
+DS1307 myrtc(I2C_SDA,I2C_SCL);
+DigitDisplay display(D7,D8);
+DigitalOut buzzer(D6);
+
+int main() {
+ // DisplayTime();
+ display.Displayset(4,6,4,7);
+}
+
+void DisplayTime()
+{
+ int sec=0,min=35,hour=15,day=7,date=5,month=12,year=15;
+ int a_hour=15,a_min=36;
+
+ myrtc.settime(sec,min,hour,day,date,month,year);
+
+ printf("time set : %d:%d:%d day : %d date set : %d:%d:%d\n ",hour,min,sec,day,date,month,year);
+
+ while(1) {
+ myrtc.gettime(&sec,&min,&hour,&day,&date,&month,&year);
+ printf("time read : %d:%d:%d day : %d date read : %d:%d:%d\n ",hour,min,sec,day,date,month,year);
+
+ display.setColon(1);
+
+ if(((hour-(hour%10))/10)>0)
+ {
+ display.write(0, (hour-(hour%10))/10);
+ display.write(1, hour%10);
+ display.write(2, (min-(min%10))/10);
+ display.write(3, min%10);
+ }
+ else if(((hour-(hour%10))/10)==0 )
+ {
+ display.write(0, 0xFF);
+ display.write(1, hour%10);
+ display.write(2, (min-(min%10))/10);
+ display.write(3, min%10);
+ }
+ if(hour==a_hour && min==a_min){buzzer=1;wait(2);buzzer=0;}
+
+ }
+}
