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:
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?