TaskHandle_t task0Handle;
void setup() {
pinMode(2, OUTPUT);
pinMode(23, OUTPUT);
Serial.begin(115200);
//create a task on core 0 that will be execute task1Func() with priority 10
xTaskCreatePinnedToCore(
task0, /* Task function. */
"Task1", /* name of task. */
10000, /* Stack size of task */
nullptr, /* parameter of the task */
5, /* priority of the task */
&task0Handle, /* Task handle to keep track of created task */
0); /* pin task to core 0 */
}
void task0( void * pvParameters ) {
for (;;) {
digitalWrite(2, HIGH);
delay(1000);
digitalWrite(2, LOW);
delay(300);
}
}
void loop() {
digitalWrite(23, LOW);
delay(250);
digitalWrite(23, HIGH);
delay(250);
}