Skip to content

Updating examples. #10

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 2 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Simple test

Ensure your device works with this simple test.

.. literalinclude:: ../examples/vc0706_snapshot_internal.py
:caption: examples/vc0706_snapshot_internal.py
.. literalinclude:: ../examples/vc0706_snapshot_filesystem.py
:caption: examples/vc0706_snapshot_filesystem.py
:linenos:

.. literalinclude:: ../examples/vc0706_snapshot_simpletest.py
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# VC0706 image capture to local storage.
# You must wire up the VC0706 to a USB or hardware serial port.
# Primarily for use with Linux/Raspberry Pi but also can work with Mac/Windows
"""VC0706 image capture to local storage.
You must wire up the VC0706 to a USB or hardware serial port.
Primarily for use with Linux/Raspberry Pi but also can work with Mac/Windows"""

import time
import serial
import busio
import board
import adafruit_vc0706

# Configuration:
IMAGE_FILE = 'image.jpg' # Full path to file name to save captured image.
# Will overwrite!
# Set this to the full path to the file name to save the captured image. WILL OVERWRITE!
# CircuitPython internal filesystem configuration:
IMAGE_FILE = '/image.jpg'
# USB to serial adapter configuration:
# IMAGE_FILE = 'image.jpg' # Full path to file name to save captured image. Will overwrite!
# Raspberry Pi configuration:
# IMAGE_FILE = '/home/pi/image.jpg' # Full path to file name to save image. Will overwrite!

# Create a serial connection for the VC0706 connection, speed is auto-detected.

# Create a serial connection for the VC0706 connection.
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0.25)
# Update the serial port name to match the serial connection for the camera!
uart = serial.Serial("/dev/ttyUSB0", timeout=0.25)
# For use with USB to serial adapter:
# import serial
# uart = serial.Serial("/dev/ttyUSB0", baudrate=115200, timeout=0.25)
# For use with Raspberry Pi:
# import serial
# uart = serial.Serial("/dev/ttyS0", baudrate=115200, timeout=0.25)

# Setup VC0706 camera
vc0706 = adafruit_vc0706.VC0706(uart)
Expand All @@ -21,12 +33,10 @@
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_640x480 # Or set IMAGE_SIZE_320x240 or
# IMAGE_SIZE_160x120
vc0706.image_size = adafruit_vc0706.IMAGE_SIZE_640x480
# 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
Expand Down
76 changes: 0 additions & 76 deletions examples/vc0706_snapshot_internal.py

This file was deleted.

17 changes: 9 additions & 8 deletions examples/vc0706_snapshot_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# VC0706 image capture to SD card demo.
# You must wire up the VC0706 to the board's serial port, and a SD card holder
# to the board's SPI bus. Use the Feather M0 Adalogger as it includes a SD
# card holder pre-wired to the board--this sketch is setup to use the Adalogger!
# In addition you MUST also install the following dependent SD card library:
# https://github.com/adafruit/Adafruit_CircuitPython_SD
# See the guide here for more details on using SD cards with CircuitPython:
# https://learn.adafruit.com/micropython-hardware-sd-cards
"""VC0706 image capture to SD card demo.
You must wire up the VC0706 to the board's serial port, and a SD card holder
to the board's SPI bus. Use the Feather M0 Adalogger as it includes a SD
card holder pre-wired to the board--this sketch is setup to use the Adalogger!
In addition you MUST also install the following dependent SD card library:
https://github.com/adafruit/Adafruit_CircuitPython_SD
See the guide here for more details on using SD cards with CircuitPython:
https://learn.adafruit.com/micropython-hardware-sd-cards"""

import time

import board
Expand Down