![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Alarm Clock
Fork of SmartRise_MBED by
Diff: main.cpp
- Revision:
- 7:5412a6d7ef6d
- Parent:
- 5:90f059fdc625
- Parent:
- 6:73866b51e0b7
- Child:
- 8:edf5f23cb393
--- a/main.cpp Tue Jan 26 01:12:34 2016 +0000 +++ b/main.cpp Tue Jan 26 01:22:36 2016 +0000 @@ -8,49 +8,24 @@ Serial pc(USBTX,USBRX); -TextLCD lcd(p27,p28,p23,p24,p25,p26); //RS E d1,d2,d3,d4 -DigitalIn HrAdjustUp(p6); -DigitalIn HrAdjustDown(p7); -DigitalIn MinAdjust(p8); //buttons for setting time and alarm DigitalIn AlarmAdjust(p9); InterruptIn off(p15); - -InterruptIn safetyOff(p5); +DigitalIn timeSW(p10); int main() { time_init(); off.rise(&turn_off); + while(1){ + timeDisplay(); + if(checkAlarm())Sound_Alarm(); + if(timeSW==1)timeProg(); + if(AlarmAdjust==1) alarmProg(); + + } } - - - - -/* - while(1) { - time_t seconds = time(NULL); - - - char buffer[32]; - strftime(buffer, 32, "%a%m/%d %I:%M%p", localtime(&seconds)); //day, #month/#day Hr:min (AP)M - wait(0.1); - lcd.printf("%s Alarm-%2I:%.2I", buffer, Ahr, Amin); - time_t a=localtime(&seconds); pc.printf("%i",a); //current problem - void Alarm(void); - if(AlarmAdjust==1&&set.read()>0.3){ //to be in main to call alarm adjust - if(HrAdjustUp==1) {Ahr=Ahr+1;set.reset();} - if(HrAdjustDown==1) {Ahr=Ahr-1;set.reset();} - if(MinAdjust==1) {Amin=Amin+1;set.reset();} - if(Ahr>23) Ahr=0; - if(Amin>=60) Amin=0; - } - // if( Ahr=___&&Amin=((localtime(&secods)%3600)/60 ){ - - -*/ - - + \ No newline at end of file