Procházet zdrojové kódy

Make it more chill

Erwin Ried před 2 roky
rodič
revize
92270ff0ce
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 4 1
      esp32cam_marauder/MotionDetection.ino

+ 4 - 1
esp32cam_marauder/MotionDetection.ino

@@ -79,6 +79,8 @@ void motion_detection_setup() {
     Serial.println(cam.getErrorMessage());
 }
 
+unsigned long nextMotionAlert = 0;
+
 void motion_detection_loop() {
   if (!cam.capture()) {
     Serial.println(cam.getErrorMessage());
@@ -107,8 +109,9 @@ void motion_detection_loop() {
   /**
      * Test if motion was detected
      */
-  if (detector.triggered()) {
+  if (detector.triggered() && millis()>nextMotionAlert) {
     Serial.println("Motion!");
+    nextMotionAlert = millis()+1000;
   }
 
   /**