Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5266

Camera board • Re: Libcamera error on Rpi5 when starting the gpiod

$
0
0
On a Pi5 with V3 camera module, this worked fine in a venv with gpiod library installed via pip, to blink an LED on GPIO21 whilst camera preview is running:

Code:

from picamera2 import Picamera2, Previewfrom time import sleepimport gpiodfrom gpiod.line import Direction, Valuepicam2 = Picamera2()camera_config = picam2.create_preview_configuration()picam2.configure(camera_config)picam2.start_preview(Preview.QTGL)picam2.start()LINE = 21with gpiod.request_lines(    "/dev/gpiochip4",    consumer="blink-example",    config={        LINE: gpiod.LineSettings(            direction=Direction.OUTPUT, output_value=Value.ACTIVE        )    },) as request:    n=0    while n<10:        request.set_value(LINE, Value.ACTIVE)        sleep(1)        request.set_value(LINE, Value.INACTIVE)        sleep(1)        n=n+1picam2.capture_file("test.jpg")print("Done")

Statistics: Posted by neilgl — Wed Mar 20, 2024 9:02 pm



Viewing all articles
Browse latest Browse all 5266

Trending Articles