Whitworth-EN173-2016
/
SmartRise_MBED
Alarm Clock
Fork of SmartRise_MBED by
main.cpp@11:be164273b969, 2016-01-27 (annotated)
- Committer:
- pstephens18
- Date:
- Wed Jan 27 02:03:43 2016 +0000
- Revision:
- 11:be164273b969
- Parent:
- 8:edf5f23cb393
- Child:
- 12:f42b74f76630
Working
;
Who changed what in which revision?
User | Revision | Line number | New 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 | DigitalIn AlarmAdjust(p9); |
pstephens18 | 5:90f059fdc625 | 12 | InterruptIn off(p15); |
asloop18 | 3:51b248042aa0 | 13 | |
asloop18 | 7:5412a6d7ef6d | 14 | DigitalIn timeSW(p10); |
pstephens18 | 8:edf5f23cb393 | 15 | DigitalOut led2(LED2); |
asloop18 | 3:51b248042aa0 | 16 | |
pstephens18 | 5:90f059fdc625 | 17 | int main() |
pstephens18 | 5:90f059fdc625 | 18 | { |
pstephens18 | 11:be164273b969 | 19 | time_init(); // Initializes clock and alarm times |
pstephens18 | 11:be164273b969 | 20 | off.rise(&turn_off); // Waits for signal from off switch on remote XBee |
pstephens18 | 11:be164273b969 | 21 | |
pstephens18 | 8:edf5f23cb393 | 22 | while(1) |
pstephens18 | 8:edf5f23cb393 | 23 | { |
pstephens18 | 11:be164273b969 | 24 | timeDisplay(); // Constantly Displays the Time |
pstephens18 | 11:be164273b969 | 25 | if(checkAlarm()) // Checks to see if it is time to sound the alarm and does so if apropriate |
pstephens18 | 11:be164273b969 | 26 | { |
pstephens18 | 11:be164273b969 | 27 | Sound_Alarm(); |
pstephens18 | 11:be164273b969 | 28 | } |
pstephens18 | 8:edf5f23cb393 | 29 | |
asloop18 | 6:73866b51e0b7 | 30 | if(timeSW==1)timeProg(); |
asloop18 | 6:73866b51e0b7 | 31 | if(AlarmAdjust==1) alarmProg(); |
pstephens18 | 8:edf5f23cb393 | 32 | led2 = 1; |
asloop18 | 6:73866b51e0b7 | 33 | } |
asloop18 | 4:33f3750fe70a | 34 | } |
pstephens18 | 11:be164273b969 | 35 | |
pstephens18 | 11:be164273b969 | 36 | |
asloop18 | 4:33f3750fe70a | 37 | |
asloop18 | 4:33f3750fe70a | 38 | |
asloop18 | 7:5412a6d7ef6d | 39 |