26 lines
500 B
C
26 lines
500 B
C
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_log.h"
|
|
#include "driver/gpio.h"
|
|
|
|
#define LED 2
|
|
|
|
void app_main(void) {
|
|
const char *tag = "blink";
|
|
ESP_LOGI(tag, "Starting blink!\n");
|
|
|
|
const uint32_t hi = 1, lo = 0;
|
|
const TickType_t duration = 500 / portTICK_PERIOD_MS;
|
|
|
|
gpio_reset_pin(LED);
|
|
gpio_set_direction(LED, GPIO_MODE_OUTPUT);
|
|
|
|
while (1) {
|
|
gpio_set_level(LED, hi);
|
|
vTaskDelay(duration);
|
|
gpio_set_level(LED, lo);
|
|
vTaskDelay(duration);
|
|
|
|
}
|
|
}
|