MistyGro API
C++ API for MistyGro's ESP32 controller based on the Arduino framework
test_scheduler.cpp
Go to the documentation of this file.
1 // Copyright 2023 Myron Rodrigues
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <Arduino.h>
16 
17 #include "scheduler.h"
18 
20 
21 void task1() { Serial.println("Task 1"); }
22 
23 void task2() { Serial.println("Task 2"); }
24 
25 void setup()
26 {
27  Serial.begin(115200);
28  scheduler.begin(10000);
31 }
32 
33 void loop() { scheduler.run(); }
A scheduler for running tasks on the controller, minimum time between events is 1 second based off th...
Definition: scheduler.h:34
void begin(long int timer_sync_interval_ms=600000)
initialise timer
Definition: scheduler.cpp:45
void run()
This needs to be run in the loop function continuously. Best practice is to have a loop function that...
Definition: scheduler.cpp:31
void create_task(void(*task_func)(), unsigned long interval_sec)
Create a task.
Definition: scheduler.cpp:21
void setup()
Scheduler scheduler
void task2()
void task1()
void loop()