diff --git a/07_platformio_intro/.gitignore b/07_platformio_intro/.gitignore new file mode 100644 index 0000000..89cc49c --- /dev/null +++ b/07_platformio_intro/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/07_platformio_intro/.vscode/extensions.json b/07_platformio_intro/.vscode/extensions.json new file mode 100644 index 0000000..080e70d --- /dev/null +++ b/07_platformio_intro/.vscode/extensions.json @@ -0,0 +1,10 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ], + "unwantedRecommendations": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/07_platformio_intro/platformio.ini b/07_platformio_intro/platformio.ini new file mode 100644 index 0000000..f74a70b --- /dev/null +++ b/07_platformio_intro/platformio.ini @@ -0,0 +1,19 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[env:esp32doit-devkit-v1] +platform = espressif32 +board = esp32doit-devkit-v1 +framework = arduino +monitor_speed = 115200 +lib_deps = + arkhipenko/TaskScheduler@^3.8.5 + fastled/FastLED@^3.9.13 + 0nism/ESP32-DHT11@^1.0.1 diff --git a/07_platformio_intro/src/main.cpp b/07_platformio_intro/src/main.cpp new file mode 100644 index 0000000..0ff449c --- /dev/null +++ b/07_platformio_intro/src/main.cpp @@ -0,0 +1,27 @@ +#include +#include + +Scheduler ts; + +void task1Callback() { + Serial.println("Task 1 executed"); +} +void task2Callback() { + Serial.println("Task 2 executed"); +} + +Task t1(1000, TASK_FOREVER, &task1Callback); +Task t2(2500, TASK_FOREVER, &task2Callback); + +void setup() { + Serial.begin(115200); + ts.init(); + ts.addTask(t1); + ts.addTask(t2); + t1.enable(); + t2.enable(); +} + +void loop() { + ts.execute(); +} diff --git a/07_platformio_intro/test/README b/07_platformio_intro/test/README new file mode 100644 index 0000000..9b1e87b --- /dev/null +++ b/07_platformio_intro/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Test Runner and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html