Go Down

Topic: alarm.delay in libraries? (Read 376 times) previous topic - next topic

xcalabar777

I am still in the learning phase, the very early learning phase, of programming and have a possibly dumb question.  My project uses the Time and TimeAlarms libraries (and of course using an alarm in my program, two in fact) and it says to use alarm.delay in place of the regular delay.  That's easy enough, however while looking into another library I'll be using (DallasTemperature) I noticed it has delay used several times.  I'm hoping someone can tell me if this is ok, or should I go through this library along with others I use and replace any instances of delay, with alarm.delay?  Is that a huge no-no, or an ok thing to do as a precaution with no issues, or totally unnecessary and I am over thinking this?

Sorry for my bad grammar and as always, thanks for any helpful responses!

johncc

You'll be fine using Dallas Temperature, the delays in it I'm sure are short enough to not interfere with your alarms.... and TimeAlarms does not use interrupts so no problem there either...

LarryD

Just use   Alarm.delay(your value);  or   Alarm.delay(); in your loop() code.
You don't have to touch your libraries.
The reason you need the Alarm.delay() is, its this code where Alarm timers (if any) are checked and handled.

The way you have it in your schematic isn't the same as how you have it wired up!

gnusso

Then could be used Alarm.delay(); without any kind of value ?

so if i not understood bad in this way Alarm.delay(); you said to the timer please start ... correct ?

thansk
gnux

Veco

That's correct, in the readme of the timealarms library is states you may use Alarm.delay(0); if you only wish to check the alarm status and not cause a delay.

xcalabar777

Thank you for the responses! I did not realize Alarm.delay had to be called for the Alarms to trigger.  I just reread the read me file for the library and I can't believe I missed that the first time through.  Thanks for the help everyone!

Go Up