![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Alarm Clock
Fork of SmartRise_MBED by
main.cpp@13:2ba69c3dc08a, 2016-01-27 (annotated)
- Committer:
- pstephens18
- Date:
- Wed Jan 27 04:59:13 2016 +0000
- Revision:
- 13:2ba69c3dc08a
- Parent:
- 12:f42b74f76630
Mission Accomplished
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 | |
pstephens18 | 12:f42b74f76630 | 11 | DigitalIn AlarmAdjust(p9); // Used to Adjust the Alarm |
pstephens18 | 12:f42b74f76630 | 12 | InterruptIn off(p15); // Used to turn off the Alarm |
asloop18 | 3:51b248042aa0 | 13 | |
pstephens18 | 12:f42b74f76630 | 14 | DigitalIn timeSW(p10); // Used to adjust the time |
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 | |
pstephens18 | 12:f42b74f76630 | 30 | if(timeSW==1)timeProg(); // Activate using black switch |
pstephens18 | 13:2ba69c3dc08a | 31 | if(AlarmAdjust==1) alarmProg(); // Activate using Blue button with switch closed |
asloop18 | 6:73866b51e0b7 | 32 | } |
asloop18 | 4:33f3750fe70a | 33 | } |
pstephens18 | 11:be164273b969 | 34 | |
pstephens18 | 11:be164273b969 | 35 | |
asloop18 | 4:33f3750fe70a | 36 | |
asloop18 | 4:33f3750fe70a | 37 | |
pstephens18 | 13:2ba69c3dc08a | 38 |