Skip to content

Commit

Permalink
Start to add alarm IDs
Browse files Browse the repository at this point in the history
So we might be able to adjust them in the longer term.
  • Loading branch information
Siddyboy committed Mar 21, 2020
1 parent 92f004b commit 81ea31f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lights.ino
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ IPAddress timeServer(143, 210, 16, 201); //0.uk.pool.ntp.org
WiFiUDP Udp;

bool lightsOn = false; // Keep track of lights' status.
AlarmID_t alarmLightsOn; // Alarm ID for turn on time.
AlarmID_t alarmLightsOff; // Alarm ID for turn off time.

void setup() {
for(int i = 0; i <= 3; i++) {
Expand Down Expand Up @@ -69,8 +71,10 @@ void setup() {
}

/*-------- Set alarms for on and off times --------*/
Alarm.alarmRepeat(ON_HOUR, ON_MINUTE, 0, allOn);
Alarm.alarmRepeat(OFF_HOUR, OFF_MINUTE, 0, allOff);
alarmLightsOn = Alarm.alarmRepeat(ON_HOUR, ON_MINUTE, 0, allOn);
alarmLightsOff = Alarm.alarmRepeat(OFF_HOUR, OFF_MINUTE, 0, allOff);
Serial.print(alarmLightsOn);
Serial.print(alarmLightsOff);

/*-------- Set correct status at startup --------*/
int nowTime = (hour() * 60) + minute();
Expand Down

0 comments on commit 81ea31f

Please sign in to comment.