You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More than one Alarm ID , but all of ID are triggered even once of the ID has disable condition
Steps To Reproduce Problem
Hardware & Software
Board ESP32 Dev Board
Shields / modules Not used
Arduino IDE version 1.8.12
Teensyduino version (if using Teensy)
Version info & package name (from Tools > Boards > Board Manager) ESP 32 Dev Module
Operating system & version Windows 7 64 Profesional
Any other software or hardware?
void setup() {
Serial.begin(9600);
while (!Serial) ; // wait for Arduino Serial Monitor
setTime(8,00,0,7,30,21); // set time to Saturday 8:29:00am Jan 1 2011
// create the alarms, to trigger at specific times
id2= Alarm.alarmRepeat(8,30,0, MorningAlarm); // 8:30am every day
// Alarm.alarmRepeat(17,45,0,EveningAlarm); // 5:45pm every day
// Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklyAlarm); // 8:30:30 every Saturday
// create timers, to trigger relative to when they're created
Alarm.timerRepeat(15, Repeats); // timer for every 15 seconds
id1 = Alarm.timerRepeat(2, Repeats2); // timer for every 2 seconds
Alarm.timerOnce(10, OnceOnly); // called once after 10 seconds
AlarmId.disable(id1);
AlarmId.enable(id2);
}
void loop() {
digitalClockDisplay();
Alarm.delay(1000); // wait one second between clock display
}
// functions to be called when an alarm triggers:
void MorningAlarm() {
Serial.println("Alarm: - turn lights off");
}
void WeeklyAlarm() {
Serial.println("Alarm: - its Monday Morning");
}
void ExplicitAlarm() {
Serial.println("Alarm: - this triggers only at the given date and time");
}
void Repeats() {
Serial.println("15 second timer");
}
void Repeats2() {
Serial.println("2 second timer");
}
void OnceOnly() {
Serial.println("This timer only triggers once, stop the 2 second timer");
// use Alarm.free() to disable a timer and recycle its memory.
Alarm.free(id);
// optional, but safest to "forget" the ID after memory recycled
id = dtINVALID_ALARM_ID;
// you can also use Alarm.disable() to turn the timer off, but keep
// it in memory, to turn back on later with Alarm.enable().
}
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}
Description
More than one Alarm
ID
, but all ofID
are triggered even once of theID
hasdisable
conditionSteps To Reproduce Problem
Hardware & Software
Board ESP32 Dev Board
Shields / modules Not used
Arduino IDE version 1.8.12
Teensyduino version (if using Teensy)
Version info & package name (from Tools > Boards > Board Manager) ESP 32 Dev Module
Operating system & version Windows 7 64 Profesional
Any other software or hardware?
Arduino Sketch
`// Questions? Ask them here:
// http://forum.arduino.cc/index.php?topic=66054.0
#include <TimeLib.h>
#include <TimeAlarms.h>
AlarmId id1;
AlarmId id2;
void setup() {
Serial.begin(9600);
while (!Serial) ; // wait for Arduino Serial Monitor
setTime(8,00,0,7,30,21); // set time to Saturday 8:29:00am Jan 1 2011
// create the alarms, to trigger at specific times
id2= Alarm.alarmRepeat(8,30,0, MorningAlarm); // 8:30am every day
// Alarm.alarmRepeat(17,45,0,EveningAlarm); // 5:45pm every day
// Alarm.alarmRepeat(dowSaturday,8,30,30,WeeklyAlarm); // 8:30:30 every Saturday
// create timers, to trigger relative to when they're created
Alarm.timerRepeat(15, Repeats); // timer for every 15 seconds
id1 = Alarm.timerRepeat(2, Repeats2); // timer for every 2 seconds
Alarm.timerOnce(10, OnceOnly); // called once after 10 seconds
AlarmId.disable(id1);
AlarmId.enable(id2);
}
void loop() {
digitalClockDisplay();
Alarm.delay(1000); // wait one second between clock display
}
// functions to be called when an alarm triggers:
void MorningAlarm() {
Serial.println("Alarm: - turn lights off");
}
void EveningAlarm() {
Serial.println("Alarm: - turn lights on");
}
void WeeklyAlarm() {
Serial.println("Alarm: - its Monday Morning");
}
void ExplicitAlarm() {
Serial.println("Alarm: - this triggers only at the given date and time");
}
void Repeats() {
Serial.println("15 second timer");
}
void Repeats2() {
Serial.println("2 second timer");
}
void OnceOnly() {
Serial.println("This timer only triggers once, stop the 2 second timer");
// use Alarm.free() to disable a timer and recycle its memory.
Alarm.free(id);
// optional, but safest to "forget" the ID after memory recycled
id = dtINVALID_ALARM_ID;
// you can also use Alarm.disable() to turn the timer off, but keep
// it in memory, to turn back on later with Alarm.enable().
}
void digitalClockDisplay() {
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.println();
}
void printDigits(int digits) {
Serial.print(":");
if (digits < 10)
Serial.print('0');
Serial.print(digits);
}`
Result Both AlarmId are Triggered
Thanks
The text was updated successfully, but these errors were encountered: