mirror of
https://github.com/DuRuofu/ESP32-Guide.git
synced 2026-10-02 22:22:53 +08:00
27 lines
593 B
C
27 lines
593 B
C
|
|
#include <stdio.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_log.h"
|
|
#include "sdkconfig.h"
|
|
#include "led_blink.h"
|
|
|
|
static const char *TAG = "example";
|
|
|
|
static uint8_t s_led_state = 0;
|
|
|
|
void app_main(void)
|
|
{
|
|
|
|
/* Configure the peripheral according to the LED type */
|
|
configure_led();
|
|
|
|
while (1) {
|
|
ESP_LOGI(TAG, "Turning the LED %s!", s_led_state == true ? "ON" : "OFF");
|
|
blink_led(s_led_state);
|
|
/* Toggle the LED state */
|
|
s_led_state = !s_led_state;
|
|
vTaskDelay(CONFIG_BLINK_PERIOD / portTICK_PERIOD_MS);
|
|
}
|
|
}
|