Has anyone managed to use RTOS tasks with an ESP32-S3?
- stevenbennett
- Posts: 34
- Joined: Sun May 19, 2024 7:30 am
- Location: High Bentham, UK
Has anyone managed to use RTOS tasks with an ESP32-S3?
Has anyone managed to use RTOS tasks with an ESP32-S3, if so could they post some working code here please?
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: Has anyone managed to use RTOS tasks with an ESP32-S3?
Should work the exact same way as with the original ESP32.
- stevenbennett
- Posts: 34
- Joined: Sun May 19, 2024 7:30 am
- Location: High Bentham, UK
Re: Has anyone managed to use RTOS tasks with an ESP32-S3?
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() {
}
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() {
}
Who is online
Users browsing this forum: No registered users and 145 guests