mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 11:19:57 +00:00
Can take a single photo, haven't tested regular workflow
This commit is contained in:
26
pico_files/single_photo.py
Normal file
26
pico_files/single_photo.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# A single, simple photo
|
||||
|
||||
# Import required modules
|
||||
from machine import Pin, SPI, reset
|
||||
from camera import *
|
||||
from time import sleep
|
||||
|
||||
spi = SPI(0,sck=Pin(18), miso=Pin(16), mosi=Pin(19), baudrate=8000000) # Pins for the Raspberry Pi Pico
|
||||
cs = Pin(17, Pin.OUT)
|
||||
|
||||
# A manager to handling new photos being taken
|
||||
filemanager = FileManager()
|
||||
print(1)
|
||||
# Create a "Camera" object with the SPI interface defined above
|
||||
cam = Camera(spi, cs, debug_text_enabled=True) # Default resolution of 640x480
|
||||
sleep(1)
|
||||
print(2)
|
||||
# Capture a photo - this only takes a moment
|
||||
cam.capture_jpg()
|
||||
print(3)
|
||||
# To let any data settle
|
||||
sleep(.1)
|
||||
print(4)
|
||||
# Save the photo into the onboard memory
|
||||
cam.save_JPG(filemanager.new_jpg_filename('image'))
|
||||
print(5)
|
||||
Reference in New Issue
Block a user