File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ # SPDX-FileCopyrightText: 2017 Tim Cocks for Adafruit Industries
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ import board
6
+ import busio
7
+ import adafruit_vc0706
8
+
9
+ # Create a serial connection for the VC0706 connection, speed is auto-detected.
10
+ uart = busio .UART (board .TX , board .RX )
11
+ # Setup VC0706 camera
12
+ vc0706 = adafruit_vc0706 .VC0706 (uart )
13
+
14
+ # Print the version string from the camera.
15
+ print ("VC0706 version:" )
16
+ print (vc0706 .version )
17
+
18
+ # Set the baud rate to 115200 for fastest transfer (its the max speed)
19
+ vc0706 .baudrate = 115200
20
+
21
+ # Set the image size.
22
+ vc0706 .image_size = adafruit_vc0706 .IMAGE_SIZE_160x120 # Or set IMAGE_SIZE_320x240 or
23
+
24
+ # Note you can also read the property and compare against those values to
25
+ # see the current size:
26
+ size = vc0706 .image_size
27
+ if size == adafruit_vc0706 .IMAGE_SIZE_640x480 :
28
+ print ("Using 640x480 size image." )
29
+ elif size == adafruit_vc0706 .IMAGE_SIZE_320x240 :
30
+ print ("Using 320x240 size image." )
31
+ elif size == adafruit_vc0706 .IMAGE_SIZE_160x120 :
32
+ print ("Using 160x120 size image." )
33
+
34
+ # Turn on motion detection
35
+ vc0706 .motion_detection = True
36
+
37
+ # Detect motion
38
+ while True :
39
+ if vc0706 .motion_detected :
40
+ print ("Motion detected!" )
41
+ else :
42
+ print ("...." )
You can’t perform that action at this time.
0 commit comments