| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- // app_main.c
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #include "esp_log.h"
- #include "nvs_flash.h"
- #include "wifi_http.h" // 引入wifi_http.c中的头文件
- #include "http_request.h" // 引入http_request.c中的头文件
- #include "camera.h"
- static const char *TAG = "app_main";
- // 主函数
- void app_main(void)
- {
- // 初始化NVS
- esp_err_t ret = nvs_flash_init();
- if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
- ESP_ERROR_CHECK(nvs_flash_erase());
- ret = nvs_flash_init();
- }
- ESP_ERROR_CHECK(ret);
- // 初始化Wi-Fi并连接
- wifi_init_sta();
- // 等待Wi-Fi连接
- vTaskDelay(10000 / portTICK_PERIOD_MS);
- take_photo();
- vTaskDelay(4*1000 / portTICK_PERIOD_MS);
- ESP_LOGI(TAG, "测试");
- while (true)
- {
- /* code */
- // 执行HTTP GET请求
- vTaskDelay(4*1000 / portTICK_PERIOD_MS);
- }
-
- }
|