Alarm Clock

Dependencies:   TextLCD mbed

Fork of SmartRise_MBED by Austin Sloop

Committer:
asloop18
Date:
Tue Jan 26 00:47:00 2016 +0000
Revision:
4:33f3750fe70a
Parent:
3:51b248042aa0
Child:
5:90f059fdc625
Child:
6:73866b51e0b7
Time functions move in progress to CPP

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