Arduino-Scheduler
Portable Collaborative Multi-Tasking Scheduler for Arduino
Alarm.h
Go to the documentation of this file.
1 
22 #ifndef ALARM_H
23 #define ALARM_H
24 
25 #include "Clock.h"
26 
27 namespace Alarm {
28 
29  unsigned long time = 0;
30 
31  void setup()
32  {
33  }
34 
35  void loop()
36  {
37  unsigned long seconds = Clock::seconds;
38  if ((time != 0) && (seconds == time)) {
39  Serial.println(F("alarm"));
40  time += 20;
41  }
42  await(seconds != Clock::seconds);
43  }
44 };
45 #endif
void loop()
Definition: Alarm.h:35
Definition: Alarm.h:27
#define await(cond)
Definition: Scheduler.h:162
void setup()
Definition: Alarm.h:31
volatile unsigned long seconds
Definition: Clock.h:27
unsigned long time
Definition: Alarm.h:29