-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
780323e
commit 43baef4
Showing
5 changed files
with
182 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
libraries/Portenta_Camera/examples/Envie_cameraMD/Envie_cameraMD.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "camera.h" | ||
|
||
CameraClass cam; | ||
uint8_t fb[320*240]; | ||
bool motion_detected = false; | ||
|
||
void on_motion() | ||
{ | ||
motion_detected = true; | ||
} | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
|
||
pinMode(LEDB, OUTPUT); | ||
digitalWrite(LEDB, HIGH); | ||
|
||
// Init the cam QVGA, 30FPS | ||
cam.begin(CAMERA_R320x240, 60); | ||
|
||
cam.setMDThreshold(100, 200); | ||
cam.setMDWindow(0, 0, 320, 240); | ||
cam.enableMD(true, on_motion); | ||
} | ||
|
||
void loop() { | ||
// put your main code here, to run repeatedly: | ||
if (motion_detected) { | ||
Serial.printf("Motion Detected!\n"); | ||
digitalWrite(LEDB, LOW); | ||
delay(500); | ||
cam.clearMDFlag(); | ||
motion_detected =false; | ||
digitalWrite(LEDB, HIGH); | ||
} | ||
delay(10); | ||
} |