alarm with reset

Dependencies:   RTC-DS1307 mbed

main.cpp

Committer:
Owenmatthewmcgowan
Date:
2017-05-23
Revision:
1:bd4c4722c453
Parent:
0:72a2484d36f7

File content as of revision 1:bd4c4722c453:

#include "mbed.h"
#include "Rtc_Ds1307.h"
Rtc_Ds1307 rtc(A4,A5);
DigitalOut buzzer(PTC9);
DigitalOut gnd(PTC11);

Rtc_Ds1307::Time_rtc tm = ();
Rtc_Ds1307::Time_rtc A_tm = ();

bool f_reset ;
bool f_alarm ;
void setalarm(int min, int hour);
void checktime(int min, int hour);

void setalarm(int min, int hour){
        &A_tm.min = min 
        &A_tm.hour = hour    
  ; } 
   

void alarmoff (){
    gnd=0;
  //  buzzer.period(0);
  //  buzzer.write(0);
   buzzer = 0;
}


void alarmon (){
    gnd = 0;
  // buzzer.period(0.1);
  // buzzer.write(.75);
  buzzer = 1 ;
  
}    
        
void checktime(int min, int hour){
    if (&A_tm.hour == &tm.hour) && ( &A_tm.min == &tm.min ){
        if (f_alarm) {
            alarm_on()
        } 
    }
;}


void checkreset() {
    if (f_reset) {
        alarm_off() 
        }
}