// Use only core 1
#if CONFIG_FREERTOS_UNICORE
static const BaseType_t app_cpu = 0;
#else
static const BaseType_t app_cpu = 1;
#endif
const char msg[] = "Hola mundo!";
//*****************************************************************************
// Tasks
TaskHandle_t TaskHandle_1;
TaskHandle_t TaskHandle_2;
// Task: Blink LED at rate set by global variable
void TareaUART01(void *parameter) {
while (1) {
vTaskSuspend(TaskHandle_2);
for(int i=0; i<strlen(msg); i++){
Serial.print(msg[i]);
}
Serial.println("");
vTaskResume(TaskHandle_2);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void TareaUART02(void *parameter) {
while (1) {
Serial.println("-");
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}
void setup() {
// Configure pin
Serial.begin(300);
// Start blink task 1
xTaskCreatePinnedToCore( // Use xTaskCreate() in vanilla FreeRTOS
TareaUART01, // Function to be called
"Imprime hola mundo", // Name of task
1024, // Stack size (bytes in ESP32, words in FreeRTOS)
NULL, // Parameter to pass
1, // Task priority
&TaskHandle_1, // Task handle
app_cpu); // Run on one core for demo purposes (ESP32 only)
// Start blink task 2
xTaskCreatePinnedToCore( // Use xTaskCreate() in vanilla FreeRTOS
TareaUART02, // Function to be called
"Imprime un guion", // Name of task
1024, // Stack size (bytes in ESP32, words in FreeRTOS)
NULL, // Parameter to pass
2, // Task priority
&TaskHandle_2, // Task handle
app_cpu); // Run on one core for demo purposes (ESP32 only)
// Delete "setup and loop" task
vTaskDelete(NULL);
}
void loop() {
// Execution should never get here
}