UART & Sensors
Build, push image, and notify Watchtower / build-image (push) Successful in 1m39s
Build, push image, and notify Watchtower / notify (push) Successful in 1m43s

This commit is contained in:
2026-07-23 15:50:43 +02:00
parent 1ec3ee7abf
commit 2dd664c4b4
25 changed files with 2333 additions and 71 deletions
+33
View File
@@ -0,0 +1,33 @@
import grovepi
import math
from sensors.lock import grove_lock
from picamera2 import Picamera2, Preview
import time
picam2 = Picamera2()
camera_config = picam2.create_still_configuration()
picam2.configure(camera_config)
picam2.start()
time.sleep(2)
def preview_camera():
picam2.start_preview(Preview.DRM)
def stop_preview_camera():
picam2.stop_preview()
def take_picture():
"""Takes a picture and saves it to the file system"""
picam2.capture_file("test.jpg")
return "test.jpg"
def get_picture():
"""Returns the image bytes as base64
"""
file_path = take_picture()
with open(file_path, "rb") as f:
image_bytes = f.read()
return image_bytes