#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <string.h>
#include "esp_timer.h"
#include "esp_sleep.h"
#include <unistd.h>
void timer_callback(void *arg) {
printf("timer_callback\n");
}
void app_main(void) {
const esp_timer_create_args_t esp_timer_create_args = { .callback =
timer_callback, .name = "My timer" };
esp_timer_handle_t esp_timer_handle;
esp_timer_create(&esp_timer_create_args, &esp_timer_handle);
esp_timer_start_periodic(esp_timer_handle, 1000 * 1000);
while (1) {
sleep(100000);
}
}
esp32定时器timer 代码
最新推荐文章于 2024-03-12 20:29:02 发布