Skip to content

Commit ee33222

Browse files
committed
#8 - Added simple demo
1 parent 26519d9 commit ee33222

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

examples/SimpleForeverThread/SimpleForeverThread.ino

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,31 @@
22
An extremely simple example of an ESPressio Thread loop that runs on either core of the ESP32.
33
*/
44

5+
#define ESPRESSIO_THREAD_DEFAULT_STACK_SIZE = 1600 // This sets the default Stack Size for all Threads in the system.
6+
57
#include <Arduino.h>
8+
9+
#include "ESPressio_Thread.hpp"
10+
#include "ESPressio_ThreadManager.hpp"
11+
12+
using namespace ESPressio::Threads;
13+
14+
class DemoThread : public Thread {
15+
private:
16+
uint32_t _counter = 0;
17+
protected:
18+
void OnLoop() {
19+
Serial.printf("DemoThread: %u\n", _counter++);
20+
delay(1000);
21+
}
22+
};
23+
24+
DemoThread thread;
25+
26+
void setup() {
27+
Serial.begin(115200);
28+
29+
thread.SetStartOnInitialize(true);
30+
31+
ThreadManager::Initialize(); // This will initialize ALL Thread instances in your code!
32+
}

0 commit comments

Comments
 (0)