done some more fine tuning... better but not perfect... Not sure if I don't better use a motion sensor...
This commit is contained in:
35
src/main.cpp
35
src/main.cpp
@@ -26,7 +26,7 @@ using eloq::telegram;
|
|||||||
using eloq::motion::detection;
|
using eloq::motion::detection;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
delay(3000);
|
delay(5000);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
Serial.println("___MOTION DETECTION + Resolution Swtch + Send to Telegram__");
|
Serial.println("___MOTION DETECTION + Resolution Swtch + Send to Telegram__");
|
||||||
|
|
||||||
@@ -40,9 +40,9 @@ void setup() {
|
|||||||
// see example of motion detection for config values
|
// see example of motion detection for config values
|
||||||
detection.skip(5);
|
detection.skip(5);
|
||||||
detection.stride(1);
|
detection.stride(1);
|
||||||
detection.threshold(5);
|
detection.threshold(3);
|
||||||
detection.ratio(0.2);
|
detection.ratio(0.1);
|
||||||
detection.rate.atMostOnceEvery(5).seconds();
|
detection.rate.atMostOnceEvery(1).seconds();
|
||||||
|
|
||||||
// init camera
|
// init camera
|
||||||
while (!camera.begin().isOk())
|
while (!camera.begin().isOk())
|
||||||
@@ -66,9 +66,6 @@ void setup() {
|
|||||||
Serial.println("Awaiting for motion...");
|
Serial.println("Awaiting for motion...");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// capture picture
|
// capture picture
|
||||||
if (!camera.capture().isOk()) {
|
if (!camera.capture().isOk()) {
|
||||||
@@ -91,19 +88,16 @@ void loop() {
|
|||||||
camera.getSizeInBytes()
|
camera.getSizeInBytes()
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*Serial.println("Taking photo of motion at higher resolution");
|
||||||
Serial.println("Taking photo of motion at higher resolution");
|
// Maximum Resolution I can send via telegram is SVGA
|
||||||
|
camera.resolution.at(FRAMESIZE_SVGA, []() {
|
||||||
camera.resolution.at(FRAMESIZE_UXGA, []() {
|
|
||||||
Serial.printf(
|
Serial.printf(
|
||||||
"Switched to higher resolution: %dx%d. It took %d ms to switch\n",
|
"Switched to higher resolution: %dx%d. It took %d ms to switch\n",
|
||||||
camera.resolution.getWidth(),
|
camera.resolution.getWidth(),
|
||||||
camera.resolution.getHeight(),
|
camera.resolution.getHeight(),
|
||||||
camera.resolution.benchmark.millis()
|
camera.resolution.benchmark.millis()
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
// capture new frame
|
// capture new frame
|
||||||
Serial.println("Capturing Frame");
|
Serial.println("Capturing Frame");
|
||||||
digitalWrite(4,HIGH);
|
digitalWrite(4,HIGH);
|
||||||
@@ -113,11 +107,6 @@ void loop() {
|
|||||||
}
|
}
|
||||||
digitalWrite(4,LOW);
|
digitalWrite(4,LOW);
|
||||||
|
|
||||||
Serial.printf(
|
|
||||||
"Frame size is now %d bytes\n",
|
|
||||||
camera.getSizeInBytes()
|
|
||||||
);
|
|
||||||
|
|
||||||
// send text to telegram
|
// send text to telegram
|
||||||
/* Serial.println("Sending Text to Telegram");
|
/* Serial.println("Sending Text to Telegram");
|
||||||
String text="TEST";
|
String text="TEST";
|
||||||
@@ -134,15 +123,13 @@ void loop() {
|
|||||||
} else {
|
} else {
|
||||||
Serial.println(telegram.exception.toString());
|
Serial.println(telegram.exception.toString());
|
||||||
}
|
}
|
||||||
if (telegram.to(TELEGRAM_CHAT2).send(camera.frame).isOk()){
|
/* if (telegram.to(TELEGRAM_CHAT2).send(camera.frame).isOk()){
|
||||||
Serial.println("Photo sent to Telegram");
|
Serial.println("Photo sent to Telegram");
|
||||||
} else {
|
} else {
|
||||||
Serial.println(telegram.exception.toString());
|
Serial.println(telegram.exception.toString());
|
||||||
}
|
} */
|
||||||
|
|
||||||
/* });
|
/* });
|
||||||
Serial.println("Resolution switched back to VGA");
|
Serial.println("Resolution switched back to VGA"); */
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user