Page 1 of 1

Has anyone managed to use RTOS tasks with an ESP32-S3?

Posted: Fri Aug 30, 2024 7:05 am
by stevenbennett
Has anyone managed to use RTOS tasks with an ESP32-S3, if so could they post some working code here please?

Re: Has anyone managed to use RTOS tasks with an ESP32-S3?

Posted: Fri Aug 30, 2024 9:15 am
by ESP_Sprite
Should work the exact same way as with the original ESP32.

Re: Has anyone managed to use RTOS tasks with an ESP32-S3?

Posted: Fri Aug 30, 2024 10:08 am
by stevenbennett
Yes you are correct, it should, I don't know why it was not working. Anyway I can answer my own question if anyone needs some basic code to get two, or more, tasks running try the following code which does run on an S3:

void setup() {

Serial.begin(115200);

xTaskCreate(printTask, "print_task", 5000, NULL, 1, NULL);

xTaskCreate(flashTask, "flash_task", 5000, NULL, 1, NULL);

}

static void printTask(void *pvParameter)
{
while (1) {
Serial.println("printing");
vTaskDelay(2000 / portTICK_PERIOD_MS); // Delay for 2000mS
}
}

static void flashTask(void *pvParameter)
{
while (1) {
//Serial.println("flashing");
//delay(1000);

digitalWrite(RGB_BUILTIN, HIGH); // Turn the RGB LED white
vTaskDelay(500 / portTICK_PERIOD_MS); // Delay for 500mS
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
vTaskDelay(500 / portTICK_PERIOD_MS); // Delay for 500mS
}
}

void loop() {

}