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

TaskHandle_t Task1;
 
// Variable partagée par les deux process
 
int i = 0;
 
void setup() {
 
  Serial.begin(115200); 
 
  // By default, Arduino sketches run on core 1
 
  // 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 */
}
 
void Task1code( void * pvParameters ){
  for(;;){
    Serial.print("Core ");
    Serial.print(xPortGetCoreID());
    Serial.print(":");
    Serial.println(i++);
    delay(1000);
  } 
}
 
void loop() {
  Serial.print("Core ");
  Serial.print(xPortGetCoreID());
  Serial.print(":");
  Serial.println(i++);
  delay(300);
  }