From 9c264ef6db84f038df2e5fa13110a38002e28ee2 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 22 Feb 2021 00:01:21 +0200 Subject: [PATCH] Update examples. --- .../Portenta-H7/21-Sensor-Control/himax_motion_detection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py b/scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py index e3b09345f..59ac4f459 100644 --- a/scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py +++ b/scripts/examples/Arduino/Portenta-H7/21-Sensor-Control/himax_motion_detection.py @@ -6,8 +6,12 @@ from pyb import Pin, ExtInt sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QVGA) +sensor.skip_frames(time=2000) + +# The sensor is less noisy are lower FPS. sensor.set_framerate(15) +# Configure and enable motion detection sensor.ioctl(sensor.IOCTL_HIMAX_MD_THRESHOLD, 0x01) sensor.ioctl(sensor.IOCTL_HIMAX_MD_WINDOW, (0, 0, 320, 240)) sensor.ioctl(sensor.IOCTL_HIMAX_MD_CLEAR) @@ -19,6 +23,7 @@ def on_motion(line): motion_detected = True led = pyb.LED(3) +# Configure external interrupt pin. When motion is detected, this pin is pulled high ext = ExtInt(Pin("PC15"), ExtInt.IRQ_RISING, Pin.PULL_DOWN, on_motion) clock = time.clock()