Last time when I ask about my project - multi channel kitchen timer - you suggested to use mills instead of delay. So, I jumped to learning stage. I learned a lot about mills and implemented all to my sketch. I re-write my code with mills instead of delay. Works great. However, I found - very fast - it is not good solution to project. Went back to learning stage. I find out that I need interrupt - as best solution. After rewriting my code again, I finished with perfectly working sketch.
Interrupt is generated every 1 sec from DS3231. I'm happy with my sketch but try to improve it a little bit more. In my project I do not need interrupt all the time, only when I start counting.
So, my question is how I can put interrupt on hold, and restart again when is needed. SQW DS3231 pin is connected to pin 2 in Arduino Uno.
You can use detachInterrupt() to disable it when not needed and then you will have to call attachInterrupt() again when you want to start counting.
I doubt that is true. When properly implemented, millis() works just fine. But since you didn't post your sketch and what you are trying to achieve, nobody will know for sure.
Never used this DS3231 chip so there's that. However, according to the datasheet you can enable/disable either of the two chip-generated alarm interrupts. Have you tried that?
Thx for respond. I will try detachinterrrupt().
I did try mills(), however, mills need to check time - to react. When I'm busy with something else - i.e entering data - mills() doesn't control time. Perhaps I'm wrong, but I'm beginner programmer and prefer to use what I understand everything. This is why I didn't attach full sketch, because is long with tons of my comments. For sure it is not written in professional manner. Please forgive me but I'm 72 years old with new hobby.
Thx again