Skip to content

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

Merged
merged 4 commits into from
Feb 6, 2022
Merged

Conversation

brtchip-tuannguyen
Copy link
Contributor

No description provided.

@jposada202020
Copy link

@brtchip-tuannguyen
Thanks for the contribution, trying to understand the purpose of these changes:

I see that you did not include any text in the PR, we would like to understand what is the purpose of these changes.
Also, Make sure any changes you're submitting are in line with the CircuitPython Design Guide, available here:
https://circuitpython.readthedocs.io/en/latest/docs/design_guide.html

Why are you returning 1 and 0, does these particular values provide any valuable information to the end user?

Thanks,

@brtchip-tuannguyen
Copy link
Contributor Author

@jposada202020

Why are you returning 1 and 0

Thank you for pointed out. I updated returning value to true/false for the function to make it clear the purpose. Commit 67bead2

we would like to understand what is the purpose of these changes

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:
https://github.com/adafruit/Adafruit-VC0706-Serial-Camera-Library/blob/master/examples/MotionDetect/MotionDetect.ino

@jposada202020
Copy link

So seems the CI is unhappy :) ,so make sure you've run Pylint and Black locally on your code. You can do
this manually or using pre-commit. Instructions are available here: https://adafru.it/check-your-code
Thanks

@brtchip-tuannguyen
Copy link
Contributor Author

@jposada202020: Thank you for instructions. I passed pre-commit locally. Please have a try.

@evaherrada evaherrada changed the base branch from master to main June 7, 2021 15:54
Copy link
Contributor

@FoamyGuy FoamyGuy left a 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("....")

@FoamyGuy FoamyGuy merged commit a417126 into adafruit:main Feb 6, 2022
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants