Arduino-Scheduler
Portable Collaborative Multi-Tasking Scheduler for Arduino
SchedulerDebounceTemplate.ino
Go to the documentation of this file.
1 
23 #include <Scheduler.h>
24 #include "Debounce.h"
25 
26 // Check for SparkFun SAMD21 Breakout
27 #if defined(ARDUINO_ARCH_SAMD) && (USB_PID == 0x8D21)
28 #define Serial SerialUSB
29 #endif
30 
31 const int BUTTON = 4;
32 unsigned int count = 0;
33 
34 void buttonDown()
35 {
36  Serial.print(millis());
37  Serial.println(F(":buttonDown"));
38  count += 1;
39 }
40 
42 
43 void setup()
44 {
45  Serial.begin(57600);
46  while (!Serial);
47  Serial.println(F("SchedulerDebounceTemplate: started"));
48  Scheduler.start(button.setup, button.loop);
49 }
50 
51 void loop()
52 {
53  Serial.print(millis());
54  Serial.print(F(":loop::count="));
55  Serial.println(count);
56  delay(1000);
57 }
Debounce< BUTTON, buttonDown > button
unsigned int count
static void loop()
Definition: Debounce.h:32
static void setup()
Definition: Debounce.h:28
const int BUTTON
SchedulerClass Scheduler
Definition: Scheduler.cpp:53
static bool start(func_t taskSetup, func_t taskLoop, size_t stackSize=DEFAULT_STACK_SIZE)
Definition: Scheduler.cpp:76
void buttonDown()