I was trying to make an alarm timer switch using @bko 's TimeAlarms Library…
#include "TimeAlarms/TimeAlarms.h"
int flag=0;
int tripin=D7;
void powswtch()
{
if(flag==0)
{
digitalWrite(tripin,HIGH);
flag=1;
}
else if(flag==1)
{
digitalWrite(tripin,LOW);
flag=0;
}
}
void setup()
{
Time.zone(5.5);
pinMode(tripin,OUTPUT);
// create the alarms
Alarm.alarmRepeat(18,46,0, powswtch);
Alarm.alarmRepeat(05,45,0, powswtch);
}
void loop()
{
}
But this code doesn’t seem to work for some reason…Alarms are not triggering…