ESP32-CAM
esp32cam.h
Go to the documentation of this file.
1 #ifndef _ESP32CAM_H_
2 #define _ESP32CAM_H_
3 
4 #include <Arduino.h>
5 
6 #include "esp_camera.h"
7 #include "esp_http_server.h"
8 #include "esp_timer.h"
9 
10 #include "soc/soc.h" // Disable brownour problems
11 #include "soc/rtc_cntl_reg.h" // Disable brownour problems
12 
13 #include "tsl2591.h"
14 #include "WiFi.h"
15 
16 // Pin definition for I2C communication
17 #define I2C_SDA 13
18 #define I2C_SCL 14
19 #define I2C_ADDRESS 0x29
20 
21 // WiFi definitions
22 //#define SSID "AndroidAP6120"
23 //#define PASSWORD "4f5cd3453ae3"
24 #define SSID "DESKTOP-CSTFN6E"
25 #define PASSWORD "r678Q,03"
26 
27 // Pin definition for CAMERA_MODEL_AI_THINKER
28 #define CAM_PIN_PWDN 32
29 #define CAM_PIN_RESET -1
30 #define CAM_PIN_XCLK 0
31 #define CAM_PIN_SIOD 26
32 #define CAM_PIN_SIOC 27
33 
34 #define CAM_PIN_FLASH 4
35 #define CAM_PIN_LED 33
36 
37 #define CAM_PIN_D7 35
38 #define CAM_PIN_D6 34
39 #define CAM_PIN_D5 39
40 #define CAM_PIN_D4 36
41 #define CAM_PIN_D3 21
42 #define CAM_PIN_D2 19
43 #define CAM_PIN_D1 18
44 #define CAM_PIN_D0 5
45 #define CAM_PIN_VSYNC 25
46 #define CAM_PIN_HREF 23
47 #define CAM_PIN_PCLK 22
48 
49 class ESP32CAM {
50  public:
51  ESP32CAM(){};
52  camera_config_t config(void);
53  esp_err_t init(void);
54  esp_err_t capture(void);
55 
56  void startServer(void);
57 
58  boolean connectWiFi(void);
59  private:
60  static esp_err_t jpg_httpd_handler(httpd_req_t *req);
61  static esp_err_t status_handler(httpd_req_t *req);
62 
63  camera_config_t _camera_config;
64  httpd_handle_t _camera_httpd;
65 
66  const char* _ssid = SSID;
67  const char* _password = PASSWORD;
68 };
69 
70 #endif
ESP32CAM::capture
esp_err_t capture(void)
Camera capture function.
Definition: esp32cam.cpp:129
ESP32CAM::connectWiFi
boolean connectWiFi(void)
WiFi connection function.
Definition: esp32cam.cpp:78
ESP32CAM
Definition: esp32cam.h:49
ESP32CAM::init
esp_err_t init(void)
Camera initialization function.
Definition: esp32cam.cpp:104
ESP32CAM::ESP32CAM
ESP32CAM()
Definition: esp32cam.h:51
tsl2591.h
ESP32CAM::startServer
void startServer(void)
Function to start server.
Definition: esp32cam.cpp:280
ESP32CAM::config
camera_config_t config(void)
Configuration function.
Definition: esp32cam.cpp:10
PASSWORD
#define PASSWORD
Definition: esp32cam.h:25
SSID
#define SSID
Definition: esp32cam.h:24