-
Notifications
You must be signed in to change notification settings - Fork 34
/
simple.ino
63 lines (46 loc) · 1022 Bytes
/
simple.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <Arduino.h>
#include <Scheduler.h>
#include <Task.h>
class PrintTask : public Task {
protected:
void loop() {
Serial.println("Print Loop Start");
delay(5000);
Serial.println("Print Loop End");
delay(5000);
}
} print_task;
class BlinkTask : public Task {
protected:
void setup() {
state = HIGH;
pinMode(2, OUTPUT);
pinMode(2, state);
}
void loop() {
state = state == HIGH ? LOW : HIGH;
pinMode(2, state);
delay(1000);
}
private:
uint8_t state;
} blink_task;
class MemTask : public Task {
public:
void loop() {
Serial.print("Free Heap: ");
Serial.print(ESP.getFreeHeap());
Serial.println(" bytes");
delay(10000);
}
} mem_task;
void setup() {
Serial.begin(115200);
Serial.println("");
delay(1000);
Scheduler.start(&print_task);
Scheduler.start(&blink_task);
Scheduler.start(&mem_task);
Scheduler.begin();
}
void loop() {}