Alarm Clock

Dependencies:   TextLCD mbed

Fork of SmartRise_MBED by Austin Sloop

Committer:
pstephens18
Date:
Tue Jan 26 01:12:34 2016 +0000
Revision:
5:90f059fdc625
Parent:
4:33f3750fe70a
Child:
7:5412a6d7ef6d
Alarm Trigger

Who changed what in which revision?

UserRevisionLine numberNew contents of line
asloop18 1:989eb818d3a3 1 //8.3 LCD control with MBED main.
asloop18 1:989eb818d3a3 2
asloop18 1:989eb818d3a3 3 #include "mbed.h"
asloop18 1:989eb818d3a3 4 #include "TextLCD.h"
asloop18 4:33f3750fe70a 5 #include "TimeControl.h"
pstephens18 5:90f059fdc625 6 #include "Alarm.h"
asloop18 4:33f3750fe70a 7 #include <time.h>
asloop18 4:33f3750fe70a 8
asloop18 4:33f3750fe70a 9 Serial pc(USBTX,USBRX);
asloop18 1:989eb818d3a3 10
asloop18 3:51b248042aa0 11 TextLCD lcd(p27,p28,p23,p24,p25,p26); //RS E d1,d2,d3,d4
asloop18 3:51b248042aa0 12 DigitalIn HrAdjustUp(p6);
asloop18 3:51b248042aa0 13 DigitalIn HrAdjustDown(p7);
asloop18 3:51b248042aa0 14 DigitalIn MinAdjust(p8); //buttons for setting time and alarm
asloop18 3:51b248042aa0 15 DigitalIn AlarmAdjust(p9);
pstephens18 5:90f059fdc625 16 InterruptIn off(p15);
asloop18 3:51b248042aa0 17
asloop18 3:51b248042aa0 18
asloop18 3:51b248042aa0 19 InterruptIn safetyOff(p5);
asloop18 3:51b248042aa0 20
asloop18 1:989eb818d3a3 21
pstephens18 5:90f059fdc625 22 int main()
pstephens18 5:90f059fdc625 23 {
asloop18 4:33f3750fe70a 24 time_init();
pstephens18 5:90f059fdc625 25 off.rise(&turn_off);
asloop18 4:33f3750fe70a 26 }
asloop18 4:33f3750fe70a 27
asloop18 4:33f3750fe70a 28
asloop18 4:33f3750fe70a 29
asloop18 4:33f3750fe70a 30
asloop18 4:33f3750fe70a 31
asloop18 4:33f3750fe70a 32
asloop18 4:33f3750fe70a 33 /*
asloop18 1:989eb818d3a3 34 while(1) {
asloop18 1:989eb818d3a3 35 time_t seconds = time(NULL);
asloop18 1:989eb818d3a3 36
asloop18 3:51b248042aa0 37
asloop18 1:989eb818d3a3 38 char buffer[32];
asloop18 2:261fce57a100 39 strftime(buffer, 32, "%a%m/%d %I:%M%p", localtime(&seconds)); //day, #month/#day Hr:min (AP)M
asloop18 2:261fce57a100 40 wait(0.1);
asloop18 3:51b248042aa0 41 lcd.printf("%s Alarm-%2I:%.2I", buffer, Ahr, Amin);
asloop18 3:51b248042aa0 42 time_t a=localtime(&seconds); pc.printf("%i",a); //current problem
asloop18 3:51b248042aa0 43 void Alarm(void);
asloop18 3:51b248042aa0 44 if(AlarmAdjust==1&&set.read()>0.3){ //to be in main to call alarm adjust
asloop18 3:51b248042aa0 45 if(HrAdjustUp==1) {Ahr=Ahr+1;set.reset();}
asloop18 3:51b248042aa0 46 if(HrAdjustDown==1) {Ahr=Ahr-1;set.reset();}
asloop18 3:51b248042aa0 47 if(MinAdjust==1) {Amin=Amin+1;set.reset();}
asloop18 3:51b248042aa0 48 if(Ahr>23) Ahr=0;
asloop18 3:51b248042aa0 49 if(Amin>=60) Amin=0;
asloop18 3:51b248042aa0 50 }
asloop18 3:51b248042aa0 51 // if( Ahr=___&&Amin=((localtime(&secods)%3600)/60 ){
asloop18 1:989eb818d3a3 52
asloop18 3:51b248042aa0 53
asloop18 4:33f3750fe70a 54 */
asloop18 3:51b248042aa0 55
asloop18 4:33f3750fe70a 56