#if CONFIG_FREERTOS_UNICORE
static const BaseType_t app_cpu = 0 ;
#else
static const BaseType_t app_cpu = 1;
#endif
// Pins
static const int led_pin = 2;
//Our task blink a led
void toggleLed(void * parameter) {
while(1) {
digitalWrite(led_pin, HIGH);
vTaskDelay(500 / portTICK_PERIOD_MS );
digitalWrite(led_pin, LOW);
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
void setup() {
pinMode(led_pin, OUTPUT);
// Task to run forever
xTaskCreatePinnedToCore(
toggleLed, // Function to be called
"ToggleLed", // name of the function
1024, // stack size
NULL, // parameter to pass to the function
1, // priority
NULL , // task handle
app_cpu
);
}
void loop() {
}