Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Chris DB
#85461 On ESP32, if I want to put a delay inside a task I do this:
Code: Select all   xTaskCreate([](void * p) {
      for (int i = 0; i < 10; i++) {
         Serial.println(String("i=") + i);
         delay(1000);
      }
      vTaskDelete(NULL);
   }, "t1", 10000, (int *)1, 0, NULL);

and a new line is printed every second.

On ESP8266, if I do this:
Code: Select all   system_os_task([](os_event_t *e) {
      for (int i = 0; i < 10; i++) {
         Serial.println(String("i=") + i);
         delay(1000);
      }
   }, 0, g_my_queue, 1);
   system_os_post(0, 0, 0);

all lines are printed without delay. `delay(1000)` has no effect inside the task.

How does one put a delay inside a task on ESP8266?