File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
examples/SimpleForeverThread Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments