-
Notifications
You must be signed in to change notification settings - Fork 12
Add motion detect feature #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@brtchip-tuannguyen I see that you did not include any text in the PR, we would like to understand what is the purpose of these changes. Why are you returning 1 and 0, does these particular values provide any valuable information to the end user? Thanks, |
Thank you for pointed out. I updated returning value to true/false for the function to make it clear the purpose. Commit 67bead2
The VC0706 camera came with an built-in motion gesture, and this commit let user to query whether any motion is detected by the camera. Here is an example on how to detect motion by VC0706 with C code: |
So seems the CI is unhappy :) ,so make sure you've run Pylint and Black locally on your code. You can do |
@jposada202020: Thank you for instructions. I passed pre-commit locally. Please have a try. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Tested successfully with Feather RP2040 and https://www.adafruit.com/product/397 with this test script:
import board
import busio
import adafruit_vc0706
# Create a serial connection for the VC0706 connection, speed is auto-detected.
uart = busio.UART(board.TX, board.RX)
# Setup VC0706 camera
vc0706 = adafruit_vc0706.VC0706(uart)
# Print the version string from the camera.
print("VC0706 version:")
print(vc0706.version)
# Set the baud rate to 115200 for fastest transfer (its the max speed)
vc0706.baudrate = 115200
# Set the image size.
vc0706.image_size = adafruit_vc0706.IMAGE_SIZE_160x120 # Or set IMAGE_SIZE_320x240 or
# IMAGE_SIZE_160x120
# Note you can also read the property and compare against those values to
# see the current size:
size = vc0706.image_size
if size == adafruit_vc0706.IMAGE_SIZE_640x480:
print("Using 640x480 size image.")
elif size == adafruit_vc0706.IMAGE_SIZE_320x240:
print("Using 320x240 size image.")
elif size == adafruit_vc0706.IMAGE_SIZE_160x120:
print("Using 160x120 size image.")
vc0706.set_motion_detect(1)
print("detecting motion:")
print(vc0706.get_motion_detect())
while True:
if vc0706.motion_detected():
print("Motion!")
print("disable motion detect")
vc0706.set_motion_detect(0)
print("enable motion detect")
vc0706.set_motion_detect(1)
else:
print("....")
Updating https://github.com/adafruit/Adafruit_CircuitPython_VC0706 to 4.3.0 from 4.2.5: > Merge pull request adafruit/Adafruit_CircuitPython_VC0706#20 from brtchip-tuannguyen/master
No description provided.