Browse Source

add pio intro

master
Jakub Škrabánek 2 months ago
parent
commit
77879fbe48
  1. 5
      07_platformio_intro/.gitignore
  2. 10
      07_platformio_intro/.vscode/extensions.json
  3. 19
      07_platformio_intro/platformio.ini
  4. 27
      07_platformio_intro/src/main.cpp
  5. 11
      07_platformio_intro/test/README

5
07_platformio_intro/.gitignore

@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch

10
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"
]
}

19
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

27
07_platformio_intro/src/main.cpp

@ -0,0 +1,27 @@
#include <Arduino.h>
#include <TaskScheduler.h>
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();
}

11
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
Loading…
Cancel
Save