Skip to content

Example for Arduino using ESP32 and running two tasks and enabling the watchdog timer.

License

Notifications You must be signed in to change notification settings

eduautomatiza/esp32-task-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1389ab7 · Oct 24, 2020

History

10 Commits
Oct 22, 2020
Oct 22, 2020
Oct 22, 2020
Oct 24, 2020
Oct 22, 2020
Oct 22, 2020
Oct 22, 2020
Oct 22, 2020
Oct 22, 2020

Repository files navigation

esp32-task-example

Example for Arduino using ESP32 and running two tasks and enabling the watchdog timer.

The project uses PlatformIO IDE for VSCode, Visual Studio Code and arduino framework for espressif32 platform;

first task, main.cpp:

void setup() {

  esp_task_wdt_init(60, true); // time in seconds
  enableLoopWDT();

  Serial.begin(115200);
  delay(100);

  // put your setup code here, to run once:
  Serial.println("Setup 1");
  createTask2();
}

void loop() {
  // put your main code here, to run repeatedly:

  Serial.println("loop 1");
  delay(1000);
}

second task, task_2.cpp:

void setup2(void) {
  enableLoop2WDT();

  // put your setup code here, to run once:
  Serial.println("Setup 2");
}

void loop2(void) {
  // put your main code here, to run repeatedly:

  Serial.println("loop 2");
  delay(3000);
}

Serial terminal output:

Setup 1
Setup 2
loop 2
loop 1
loop 1
loop 1
loop 2
loop 1
loop 1
loop 1
loop 2
loop 1

About

Example for Arduino using ESP32 and running two tasks and enabling the watchdog timer.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published