Closed Jasea closed 2 years ago
I think that the call to rtc.clearAlarm(1) should remove the alarm completley fron the DS3231, but that is not happening see the following Serial Monitor output.
clearAlarm()
only clears the alarm status:
https://adafruit.github.io/RTClib/html/class_r_t_c___d_s3231.html#aa8050b94c8333d72b31fd223eeb50911
it does not remove (disable) the alarm itself. To do that, use disableAlaram()
:
https://adafruit.github.io/RTClib/html/class_r_t_c___d_s3231.html#a9f5191fed61fd8a4716572d43f300a5a
The example sets up the alarm to fire when seconds match:
// schedule an alarm 10 seconds in the future
if(!rtc.setAlarm1(
rtc.now() + TimeSpan(10),
DS3231_A1_Second // this mode triggers the alarm when the seconds match. See Doxygen for other options
))
So if the status is cleared, but the alarm is not disable, then it will fire again later when the seconds match again.
Thank you for opening an issue on an Adafruit Arduino library repository. To improve the speed of resolution please review the following guidelines and common troubleshooting steps below before creating the issue:
Do not use GitHub issues for troubleshooting projects and issues. Instead use the forums at http://forums.adafruit.com to ask questions and troubleshoot why something isn't working as expected. In many cases the problem is a common issue that you will more quickly receive help from the forum community. GitHub issues are meant for known defects in the code. If you don't know if there is a defect in the code then start with troubleshooting on the forum first.
If following a tutorial or guide be sure you didn't miss a step. Carefully check all of the steps and commands to run have been followed. Consult the forum if you're unsure or have questions about steps in a guide/tutorial.
For Arduino projects check these very common issues to ensure they don't apply:
For uploading sketches or communicating with the board make sure you're using a USB data cable and not a USB charge-only cable. It is sometimes very hard to tell the difference between a data and charge cable! Try using the cable with other devices or swapping to another cable to confirm it is not the problem.
Be sure you are supplying adequate power to the board. Check the specs of your board and plug in an external power supply. In many cases just plugging a board into your computer is not enough to power it and other peripherals.
Double check all soldering joints and connections. Flakey connections cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.
Ensure you are using an official Arduino or Adafruit board. We can't guarantee a clone board will have the same functionality and work as expected with this code and don't support them.
If you're sure this issue is a defect in the code and checked the steps above please fill in the following fields to provide enough troubleshooting information. You may delete the guideline and text above to just leave the following details:
Arduino board: NodeMCU 1.0 (ESP 12E Module
Arduino IDE version (found in Arduino -> About Arduino menu): IArduino 1.8.19
List the steps to reproduce the problem below (if possible attach a sketch or copy the sketch code in too): LIST REPRO STEPS BELOW Hi, I am trying the DS3231_alarm.ino example from the RTClib Library 2.0.2 and have come across two problems.
load 0x4010f000, len 3460, room 16 tail 4 chksum 0xcc load 0x3fff20b8, len 40, room 4 tail 4 chksum 0xc9 csum 0xc9 v00043cc0 ~ld
This problem was resolved by adding this predefinition for the ISR void ICACHE_RAM_ATTR onAlarm();
Alarm will happen in 10 seconds! Alarm is set
16:08:25 SQW: 1 Alarm1: 0 16:08:27 SQW: 1 Alarm1: 0 16:08:29 SQW: 1 Alarm1: 0 16:08:31 SQW: 1 Alarm1: 0 16:08:33 SQW: 1 Alarm1: 0 Alarm occurred!
16:08:35 SQW: 0 Alarm1: 1 Alarm cleared Alarm should have been cleared
16:08:37 SQW: 1 Alarm1: 0 16:08:39 SQW: 1 Alarm1: 0 16:08:41 SQW: 1 Alarm1: 0 16:08:43 SQW: 1 Alarm1: 0 16:08:45 SQW: 1 Alarm1: 0 16:08:47 SQW: 1 Alarm1: 0 16:08:49 SQW: 1 Alarm1: 0 16:08:51 SQW: 1 Alarm1: 0 16:08:53 SQW: 1 Alarm1: 0 16:08:55 SQW: 1 Alarm1: 0 16:08:57 SQW: 1 Alarm1: 0 16:08:59 SQW: 1 Alarm1: 0 16:09:01 SQW: 1 Alarm1: 0 16:09:03 SQW: 1 Alarm1: 0 16:09:05 SQW: 1 Alarm1: 0 16:09:07 SQW: 1 Alarm1: 0 16:09:09 SQW: 1 Alarm1: 0 16:09:11 SQW: 1 Alarm1: 0 16:09:13 SQW: 1 Alarm1: 0 16:09:15 SQW: 1 Alarm1: 0 16:09:17 SQW: 1 Alarm1: 0 16:09:19 SQW: 1 Alarm1: 0 16:09:21 SQW: 1 Alarm1: 0 16:09:23 SQW: 1 Alarm1: 0 16:09:25 SQW: 1 Alarm1: 0 16:09:27 SQW: 1 Alarm1: 0 16:09:29 SQW: 1 Alarm1: 0 16:09:31 SQW: 1 Alarm1: 0 16:09:33 SQW: 1 Alarm1: 0 Alarm occured! BUT Alarm occurres again and at every 33 seconds past every minute.
16:09:35 SQW: 0 Alarm1: 1 Alarm cleared
16:09:37 SQW: 1 Alarm1: 0 16:09:39 SQW: 1 Alarm1: 0 I have found that if I set another alarm after the first has been cleared then it is the time of the last alarm that triggers the unwanted alarms.
I look forward to hearing your thoughts
DS3231_alarm.txt