User Tools

Site Tools


esp32_use_dual_core

This is an old revision of the document!


https://randomnerdtutorials.com/esp32-dual-core-arduino-ide/

TaskHandle_t Task1;
 
void setup() {
 
  Serial.begin(115200); 
 
  // By default, Arduino sketches run on core 1
  Serial.print("By default: running on core ");
  Serial.println(xPortGetCoreID());
 
  //create a task that will be executed in the Task1code() function, with priority 1 and executed on core 0
  xTaskCreatePinnedToCore(
                    Task1code,   /* Task function. */
                    "Task1",     /* name of task. */
                    10000,       /* Stack size of task */
                    NULL,        /* parameter of the task */
                    1,           /* priority of the task */
                    &Task1,      /* Task handle to keep track of created task */
                    0);          /* pin task to core 0 */    
 
//  delay(500); 
  }
 
void Task1code( void * pvParameters ){
  Serial.print("Task1 running on core ");
  Serial.println(xPortGetCoreID());
  for(;;){
    Serial.print("1");
    delay(1000);
  } 
}
 
void loop() {
  Serial.print("0");
  delay(700);
  }
esp32_use_dual_core.1741372342.txt.gz · Last modified: 2025/03/07 18:32 by bruno