alarm with reset
Dependencies: RTC-DS1307 mbed
Diff: main.cpp
- Revision:
- 0:72a2484d36f7
- Child:
- 1:bd4c4722c453
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue May 23 12:48:09 2017 +0000 @@ -0,0 +1,55 @@ +#include "mbed.h" +#include "Rtc_Ds1307.h" +Rtc_Ds1307 rtc(A4,A5) +PwmOut buzzer(PTC9) ; +DigitalOut gnd(PTC11) ; + + +Rtc_Ds1307::Time_rtc tm = (); +Rtc_Ds1307::Time_rtc A_tm = (); + +bool f_reset +bool f_alarm +void setalarm(int min, hour) +void checktime(int min, hour) + +//int alarm_on() { + // gnd = 0; + // buzzer.period(0.1); + // buzzer.write(.75); + // while(1) {} +//} + +void setalarm(int min, int hour){ + &A_tm.min = min ; + &A_tm.hour = hour; + } + + +//void alarmoff (){ + // gnd=0; + // buzzer.period(0); + // buzzer.write(0); +//} + + +void alarmon (){ + gnd = 0; + buzzer.period(0.1); + buzzer.write(.75); +} + +void checktime(int min, int hour){ + if (&A_tm.hour == &tm.hour) && ( &A_tm.min == &tm.min ){ + if (f_alarm) { + alarm_on() + } + } +} + + +//void checkreset() { + // if (f_reset) { + // alarm_off() + // } +//}