Created
August 17, 2023 00:02
-
-
Save nucklearproject/173e630ec0cb06e34a168a61552951c1 to your computer and use it in GitHub Desktop.
ESP32 support multiples dual core FreeRTOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <Wire.h> | |
// Prueba Multitarea(Hilos)RTOS en Diferente Nucleo ESP32 by: elprofegarcia.com | |
TaskHandle_t Tarea0; // Tarea0 parpadeo LED 0,3 segundos | |
TaskHandle_t Tarea1; // Tarea1 parpadeo LED 1 Segundo | |
// Declaraciones previas | |
void loop0(void *parameter); | |
void loop1(void *parameter); | |
void setup() { | |
Serial.begin(115200); | |
xTaskCreatePinnedToCore(loop0,"Tarea_0",1000,NULL,1,&Tarea0,0); // Core 0 | |
xTaskCreatePinnedToCore(loop1, "Tarea_1", 1000, NULL, 1, &Tarea1, 1); // Core 1 | |
} | |
void loop() { | |
} | |
void loop0(void *parameter){ // Tarea0 parpadeo LED 0,3 seg ndos | |
while(true) { | |
Serial.print(" Core " + String(xPortGetCoreID()) + "\n"); | |
delay(300); | |
} | |
} | |
void loop1(void *parameter){ // Tarea1 parpadeo LED 1 Segundo | |
while(true) { | |
Serial.print("Core " + String(xPortGetCoreID()) + "\n"); | |
delay(1000); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment