app_main.c 947 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // app_main.c
  2. #include "freertos/FreeRTOS.h"
  3. #include "freertos/task.h"
  4. #include "esp_log.h"
  5. #include "nvs_flash.h"
  6. #include "wifi_http.h" // 引入wifi_http.c中的头文件
  7. #include "http_request.h" // 引入http_request.c中的头文件
  8. #include "camera.h"
  9. static const char *TAG = "app_main";
  10. // 主函数
  11. void app_main(void)
  12. {
  13. // 初始化NVS
  14. esp_err_t ret = nvs_flash_init();
  15. if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
  16. ESP_ERROR_CHECK(nvs_flash_erase());
  17. ret = nvs_flash_init();
  18. }
  19. ESP_ERROR_CHECK(ret);
  20. // 初始化Wi-Fi并连接
  21. //wifi_init_sta();
  22. // 等待Wi-Fi连接
  23. //vTaskDelay(10000 / portTICK_PERIOD_MS);
  24. take_photo();
  25. vTaskDelay(4*1000 / portTICK_PERIOD_MS);
  26. ESP_LOGI(TAG, "测试");
  27. while (true)
  28. {
  29. /* code */
  30. // 执行HTTP GET请求
  31. vTaskDelay(4*1000 / portTICK_PERIOD_MS);
  32. }
  33. }