Files
microcontroladores-esp32-co…/capitulo-06/nucleos-esp-idf/main/main.c
T
Lucas RayanandClaude Opus 5.5 5f5506c55c
Compilar exemplos / esp32 (push) Canceled after 21m59s
Compilar exemplos / esp32c2 (push) Canceled after 0s
Compilar exemplos / esp32c3 (push) Canceled after 0s
Compilar exemplos / esp32c5 (push) Canceled after 0s
Compilar exemplos / esp32c6 (push) Canceled after 0s
Compilar exemplos / esp32c61 (push) Canceled after 0s
Compilar exemplos / esp32h2 (push) Canceled after 0s
Compilar exemplos / esp32p4 (push) Canceled after 0s
Compilar exemplos / esp32s2 (push) Canceled after 0s
Compilar exemplos / esp32s3 (push) Canceled after 0s
Exemplos do livro Microcontroladores ESP32 como projetos PlatformIO
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 12:10:42 -03:00

29 lines
822 B
C

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_cpu.h"
#include "esp_log.h"
#include "sdkconfig.h"
static const char *TAG = "nucleos";
static void tarefa(void *arg)
{
const char *nome = pcTaskGetName(NULL);
for (int i = 0; i < 3; i++) {
ESP_LOGI(TAG, "%-7s rodando no núcleo %d", nome, esp_cpu_get_core_id());
vTaskDelay(pdMS_TO_TICKS(500));
}
vTaskDelete(NULL);
}
void app_main(void)
{
ESP_LOGI(TAG, "FreeRTOS com %d núcleo(s)", CONFIG_FREERTOS_NUMBER_OF_CORES);
xTaskCreatePinnedToCore(tarefa, "fixa_0", 3072, NULL, 5, NULL, 0);
#if CONFIG_FREERTOS_NUMBER_OF_CORES > 1
xTaskCreatePinnedToCore(tarefa, "fixa_1", 3072, NULL, 5, NULL, 1);
#endif
xTaskCreatePinnedToCore(tarefa, "livre", 3072, NULL, 5, NULL, tskNO_AFFINITY);
}