Pages: [1]   Go Down
Author Topic: alarm.delay in libraries?  (Read 349 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Temple, Texas
Offline Offline
Sr. Member
****
Karma: 14
Posts: 360
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Offline Offline
Edison Member
*
Karma: 64
Posts: 2488
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Offline Offline
Sr. Member
****
Karma: 2
Posts: 428
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Pages: [1]   Go Up
Jump to: