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:
33
src/main.cpp
33
src/main.cpp
@@ -26,7 +26,7 @@ using eloq::telegram;
|
||||
using eloq::motion::detection;
|
||||
|
||||
void setup() {
|
||||
delay(3000);
|
||||
delay(5000);
|
||||
Serial.begin(115200);
|
||||
Serial.println("___MOTION DETECTION + Resolution Swtch + Send to Telegram__");
|
||||
|
||||
@@ -40,9 +40,9 @@ void setup() {
|
||||
// see example of motion detection for config values
|
||||
detection.skip(5);
|
||||
detection.stride(1);
|
||||
detection.threshold(5);
|
||||
detection.ratio(0.2);
|
||||
detection.rate.atMostOnceEvery(5).seconds();
|
||||
detection.threshold(3);
|
||||
detection.ratio(0.1);
|
||||
detection.rate.atMostOnceEvery(1).seconds();
|
||||
|
||||
// init camera
|
||||
while (!camera.begin().isOk())
|
||||
@@ -66,9 +66,6 @@ void setup() {
|
||||
Serial.println("Awaiting for motion...");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void loop() {
|
||||
// capture picture
|
||||
if (!camera.capture().isOk()) {
|
||||
@@ -91,19 +88,16 @@ void loop() {
|
||||
camera.getSizeInBytes()
|
||||
);
|
||||
|
||||
/*
|
||||
Serial.println("Taking photo of motion at higher resolution");
|
||||
|
||||
camera.resolution.at(FRAMESIZE_UXGA, []() {
|
||||
/*Serial.println("Taking photo of motion at higher resolution");
|
||||
// Maximum Resolution I can send via telegram is SVGA
|
||||
camera.resolution.at(FRAMESIZE_SVGA, []() {
|
||||
Serial.printf(
|
||||
"Switched to higher resolution: %dx%d. It took %d ms to switch\n",
|
||||
camera.resolution.getWidth(),
|
||||
camera.resolution.getHeight(),
|
||||
camera.resolution.benchmark.millis()
|
||||
);
|
||||
|
||||
*/
|
||||
|
||||
// capture new frame
|
||||
Serial.println("Capturing Frame");
|
||||
digitalWrite(4,HIGH);
|
||||
@@ -113,11 +107,6 @@ void loop() {
|
||||
}
|
||||
digitalWrite(4,LOW);
|
||||
|
||||
Serial.printf(
|
||||
"Frame size is now %d bytes\n",
|
||||
camera.getSizeInBytes()
|
||||
);
|
||||
|
||||
// send text to telegram
|
||||
/* Serial.println("Sending Text to Telegram");
|
||||
String text="TEST";
|
||||
@@ -134,15 +123,13 @@ void loop() {
|
||||
} else {
|
||||
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");
|
||||
} else {
|
||||
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