-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathMJPEG_Controls.ino
More file actions
76 lines (62 loc) · 1.72 KB
/
Copy pathMJPEG_Controls.ino
File metadata and controls
76 lines (62 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* Play/Pause/Stop MJPEG stream
*
* BE SURE TO SET "TOOLS > CORE DEBUG LEVEL = INFO"
* to turn on debug messages
*/
// if you define WIFI_SSID and WIFI_PASS before importing the library,
// you can call connect() instead of connect(ssid, pass)
//
// If you set HOSTNAME and your router supports mDNS, you can access
// the camera at http://{HOSTNAME}.local
#define WIFI_SSID "SSID"
#define WIFI_PASS "PASSWORD"
#define HOSTNAME "esp32cam"
#include <eloquent_esp32cam.h>
#include <eloquent_esp32cam/viz/mjpeg.h>
using namespace eloq;
using namespace eloq::viz;
/**
*
*/
void setup() {
delay(3000);
Serial.begin(115200);
Serial.println("___MJPEG STREAM SERVER CONTROLS___");
// camera settings
// replace with your own model!
camera.pinout.aithinker();
camera.brownout.disable();
camera.resolution.qvga();
camera.quality.high();
// init camera
while (!camera.begin().isOk())
Serial.println(camera.exception.toString());
// connect to WiFi
while (!wifi.connect().isOk())
Serial.println(wifi.exception.toString());
// start mjpeg http server
while (!mjpeg.begin().isOk())
Serial.println(mjpeg.exception.toString());
Serial.println("Camera OK");
Serial.println("WiFi OK");
Serial.println("MjpegStream OK");
Serial.println(mjpeg.address());
Serial.println("Send play/pause/stop to control the server");
}
/**
*
*/
void loop() {
if (!Serial.available())
return;
String command = Serial.readStringUntil('\n');
if (command.startsWith("play"))
mjpeg.play();
else if (command.startsWith("pause"))
mjpeg.pause();
else if (command.startsWith("stop"))
mjpeg.stop();
else
Serial.println("Unknown command");
}