DEVENDRAN M
DEVENDRAN M

Reputation: 9

Can i work with ESP32- Dev kit and ESP32-WebCam in a Sender and receiver interface?

I'm new in working with embedded programming and I've got a question that is - "I would like to make a project where if I press a button it should send a 15 seconds video to the contact number mentioned in the program (which I've yet to make. I was saying this because i wanted to explain my project). So, I'm using ESP32-Web Cam for capturing the video and send it through Wi-Fi".

I'm using Arduino IDE 2.0.4 to upload my code.

Now the problem I'm currently facing is that:

  1. Which board should I choose in Arduino IDE to upload the program (i.e., either in ESP32 Dev kit (My main uC) ?
  2. I don't know how should i make code compatible to both the ESP32 and ESP32-WebCam.

If anyone has ideas about this please help me it'd be helpful and I'd be thankful.

Thank you.

I'm using ESP32 Dev kit to upload my code in ESP32-WebCam (I'm not using FTDI cable)

I tried to make the example code ESP32 example--> Camera--> CameraWebServer with my main code as i tried importing as an H file and used the functions in my main function but it showed the following errors:

My files are arranged in the following manner: Main program

Here, I've included the files given by the 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

The error:

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'

Upvotes: 0

Views: 182

Answers (1)

Robert L
Robert L

Reputation: 106

Unfortunately, both Adafruit_Sensor.h and Esp_Camera.h, included by reference by your last line, name incompatible things "_sensor_t".

One solution is to rename sensor_t to Adafruit_sensor_t in all Adafruit-derived files like Adafruit_BME280.* and Adafruit_Sensor.* (and any others you may be using).

An "easy" way to do this is copy the headers into your tree, change Adafruit_Sensor.h as above (you're probably not using BME280 from your description) and then change your

#include <Adafruit_sensor.h>

(pulling it from the system includes) to

#include "Adafruit_Sensor.h"

(pulling it from your project directory).

It's unfortunate that C doesn't have namespaces, but that was the language chosen.

Oh, on the LED_BUILTIN thing, that's up to you to provide. If you stick the LED on GPIO pin 20 (example - not a recommendation), add a #define LED_BUILTIN 20 near the top of your source file that uses it or an an appropriate header that's included everywhere you use it. (Or in your build system with -DLED_BUILTIN=20 - you have options.)

Upvotes: 0

Related Questions