Alarm Clock

Dependencies:   TextLCD mbed

Fork of SmartRise_MBED by Austin Sloop

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 //8.3 LCD control with MBED main.
00002 
00003 #include "mbed.h"
00004 #include "TextLCD.h"
00005 #include "TimeControl.h"
00006 #include "Alarm.h"
00007 #include <time.h>
00008 
00009 Serial pc(USBTX,USBRX);
00010 
00011 DigitalIn AlarmAdjust(p9);   // Used to Adjust the Alarm
00012 InterruptIn off(p15);       // Used to turn off the Alarm
00013 
00014 DigitalIn timeSW(p10);    // Used to adjust the time
00015 DigitalOut led2(LED2);
00016 
00017 int main() 
00018 {
00019     time_init();            // Initializes clock and alarm times
00020     off.rise(&turn_off);  // Waits for signal from off switch on remote XBee
00021     
00022     while(1)
00023     {
00024         timeDisplay(); // Constantly Displays the Time
00025         if(checkAlarm())  // Checks to see if it is time to sound the alarm and does so if apropriate
00026         {
00027             Sound_Alarm();
00028         }
00029         
00030         if(timeSW==1)timeProg();           // Activate using black switch
00031         if(AlarmAdjust==1) alarmProg();    // Activate using Blue button with switch closed 
00032     }
00033 }
00034 
00035 
00036    
00037    
00038