Hello,
I am looking for some guidance on the usage of the GPIO pin in the OAK 4 D Pro camera. I am using the Python APIs to set this pin as HIGH but I am not able to see any change in output. I am setting the BoardConfig gpio pin as 7 and I have also tried with 52 as is the one specified for older versions.
Please find the example code that I am modifying to test this functionality.
#!/usr/bin/env python3
import cv2
import depthai as dai
#Create a Board Configuration
board = dai.BoardConfig()
#Set up GPIO (Assume GPIO pin 7)
gpio_pin = 52
gpio_config = dai.BoardConfig.GPIO()
gpio_config.direction = dai.BoardConfig.GPIO.Direction.OUTPUT
gpio_config.level = dai.BoardConfig.GPIO.Level.LOW
#Assign the GPIO configuration to the board
board.gpio = dai.BoardConfig.GPIOMap()
board.gpio[gpio_pin] = gpio_config
#Apply the Board Configuration to the device
# device = dai.Pipeline()
# device.setBoardConfig(board)
# Create pipeline
with dai.Pipeline() as pipeline:
# Define source and output
cam = pipeline.create(dai.node.Camera).build()
videoQueue = cam.requestOutput((640,400)).createOutputQueue()
# Connect to device and start pipeline
pipeline.start()
while pipeline.isRunning():
#Placeholder for GPIO control
condition_met = True
if condition_met:
#set GPIO pin to high
gpio_config.level = dai.BoardConfig.GPIO.Level.HIGH
board.gpio[gpio_pin] = gpio_config
pipeline.setBoardConfig(board)
print(f"GPIO {gpio_pin} set to HIGH")
videoIn = videoQueue.get()
assert isinstance(videoIn, dai.ImgFrame)
cv2.imshow("video", videoIn.getCvFrame())
if cv2.waitKey(1) == ord("q"):
break