Alarm Clock

Dependencies:   TextLCD mbed

Fork of SmartRise_MBED by Austin Sloop

main.cpp

Committer:
pstephens18
Date:
2016-01-27
Revision:
12:f42b74f76630
Parent:
11:be164273b969
Child:
13:2ba69c3dc08a

File content as of revision 12:f42b74f76630:

//8.3 LCD control with MBED main.

#include "mbed.h"
#include "TextLCD.h"
#include "TimeControl.h"
#include "Alarm.h"
#include <time.h>

Serial pc(USBTX,USBRX);

DigitalIn AlarmAdjust(p9);   // Used to Adjust the Alarm
InterruptIn off(p15);       // Used to turn off the Alarm

DigitalIn timeSW(p10);    // Used to adjust the time
DigitalOut led2(LED2);

int main() 
{
    time_init();            // Initializes clock and alarm times
    off.rise(&turn_off);  // Waits for signal from off switch on remote XBee
    
    while(1)
    {
        timeDisplay(); // Constantly Displays the Time
        if(checkAlarm())  // Checks to see if it is time to sound the alarm and does so if apropriate
        {
            Sound_Alarm();
        }
        
        if(timeSW==1)timeProg();           // Activate using black switch
        if(AlarmAdjust==1) alarmProg();    // Activate using Blue button with switch closed
        led2 = 1; 
    }
}