我是嵌入式编程的新手,我有一个问题 - “我想做一个项目,如果我按下按钮,它应该向程序中提到的联系号码发送一个 15 秒的视频(我还没有制作。我这么说是因为我想解释我的项目)。所以,我使用 ESP32-Web Cam 来捕获视频并通过 Wi-Fi 发送它”。
我正在使用 Arduino IDE 2.0.4 上传我的代码。
现在我面临的问题是:
如果有人对此有想法,请帮助我,这会很有帮助,我将不胜感激。
谢谢你。
我正在使用 ESP32 开发套件在 ESP32-WebCam 中上传我的代码(我没有使用 FTDI 电缆)
我尝试使用我的主代码制作示例代码 ESP32 example--> Camera--> CameraWebServer,因为我尝试作为 H 文件导入并使用主函数中的函数,但它显示了以下错误:
我的文件按以下方式排列: 主程序
这里,我包含了 ESP32-Examples 给出的文件。
#include "DHT.h"
#define DHT11PIN 16
#define LIGHT_SENSOR_PIN 36
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "RTClib.h"
#include "esp32_webCam.h" //This is the CameraWebServer file that i'm including in the main file
错误:
In file included from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:71,
from G:\All_Program\all_program\esp32_webCam.h:1,
from G:\All_Program\all_program\all_program.ino:11:
C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/esp32-camera/driver/include/sensor.h:201:24: error: conflicting declaration 'typedef struct _sensor sensor_t'
typedef struct _sensor sensor_t;
^~~~~~~~
In file included from c:\Users\Documents\Arduino\libraries\Adafruit_MPU6050/Adafruit_MPU6050.h:23,
from G:\All_Program\all_program\all_program.ino:4:
c:\Users\Documents\Arduino\libraries\Adafruit_Unified_Sensor/Adafruit_Sensor.h:157:3: note: previous declaration as 'typedef struct sensor_t sensor_t'
} sensor_t;
^~~~~~~~
In file included from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h:71,
from G:\All_Program\all_program\esp32_webCam.h:1,
from G:\All_Program\all_program\all_program.ino:11:
C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4/tools/sdk/esp32/include/esp32-camera/driver/include/sensor.h:249:3: error: conflicting declaration 'typedef struct _sensor sensor_t'
} sensor_t;
^~~~~~~~
In file included from c:\Users\Emb Lab\Documents\Arduino\libraries\Adafruit_MPU6050/Adafruit_MPU6050.h:23,
from G:\All_Program\all_program\all_program.ino:4:
c:\Users\Documents\Arduino\libraries\Adafruit_Unified_Sensor/Adafruit_Sensor.h:157:3: note: previous declaration as 'typedef struct sensor_t sensor_t'
} sensor_t;
^~~~~~~~
In file included from G:\All_Program\all_program\all_program.ino:11:
G:\All_Program\all_program\esp32_webCam.h: In function 'void cam_setup()':
G:\All_Program\all_program\esp32_webCam.h:108:10: error: 'struct sensor_t' has no member named 'id'
if (s->id.PID == OV3660_PID) {
^~
G:\All_Program\all_program\esp32_webCam.h:109:8: error: 'struct sensor_t' has no member named 'set_vflip'
s->set_vflip(s, 1); // flip it back
^~~~~~~~~
G:\All_Program\all_program\esp32_webCam.h:110:8: error: 'struct sensor_t' has no member named 'set_brightness'
s->set_brightness(s, 1); // up the brightness just a bit
^~~~~~~~~~~~~~
G:\All_Program\all_program\esp32_webCam.h:111:8: error: 'struct sensor_t' has no member named 'set_saturation'; did you mean 'resolution'?
s->set_saturation(s, -2); // lower the saturation
^~~~~~~~~~~~~~
resolution
G:\All_Program\all_program\esp32_webCam.h:115:8: error: 'struct sensor_t' has no member named 'set_framesize'
s->set_framesize(s, FRAMESIZE_QVGA);
^~~~~~~~~~~~~
G:\All_Program\all_program\all_program.ino: In function 'void pulsesensor()':
G:\All_Program\all_program\all_program.ino:72:19: error: 'LED_BUILTIN' was not declared in this scope
digitalWrite(LED_BUILTIN,HIGH);
^~~~~~~~~~~
G:\All_Program\all_program\all_program.ino:76:19: error: 'LED_BUILTIN' was not declared in this scope
digitalWrite(LED_BUILTIN,LOW);
^~~~~~~~~~~
G:\All_Program\all_program\all_program.ino: In function 'void setup()':
G:\All_Program\all_program\all_program.ino:283:11: error: 'LED_BUILTIN' was not declared in this scope
pinMode(LED_BUILTIN,OUTPUT);
^~~~~~~~~~~
exit status 1
Compilation error: 'struct sensor_t' has no member named 'id'
不幸的是,Adafruit_Sensor.h 和 Esp_Camera.h(通过最后一行引用包含)将不兼容的事物命名为“_sensor_t”。
一种解决方案是在所有 Adafruit 派生文件(例如 Adafruit_BME280.* 和 Adafruit_Sensor.*)(以及您可能使用的任何其他文件)中将sensor_t 重命名为 Adafruit_sensor_t。
执行此操作的“简单”方法是将标头复制到树中,如上所述更改 Adafruit_Sensor.h(您可能没有使用描述中的 BME280),然后更改您的
#包括
(从系统中拉出它)到
#include“Adafruit_Sensor.h”
(从项目目录中提取它)。
不幸的是,C 没有命名空间,但这是我们选择的语言。