This is the infamous blinky program. The goal is to turn on the LED for 1 second, turn it off for 1 second, and repeat indefinitely.
#include "freertos/FreeRTOS.h" // pdMS_TO_TICKS
#include "freertos/task.h" // vTaskDelay()
#include "driver/gpio.h" // gpio_set_direction(), gpio_set_level()
const int LED_PIN = 5;
void app_main() {
gpio_set_direction(LED_PIN, GPIO_MODE_OUTPUT);
while (1) {
gpio_set_level(LED_PIN, 0);
vTaskDelay(pdMS_TO_TICKS(1000));
gpio_set_level(LED_PIN, 1);
vTaskDelay(pdMS_TO_TICKS(1000));
}
}