Hi!
I have an H7 attached to a Pan/Tilt module and am trying to take a series of pictures as the camera incrementally pans. As the servo increments every x degrees, it seems that the image being displayed in the IDE is from 2 positions back. I tried to add a while loop to wait for sensor.snapshot to return something, thinking maybe that wasn’t it, but the syntax is wrong. I’m not sure that’s what’s going on, so I figured I’d ask. I posted the code below. Thanks!
import sensor, image,time
from pyb import Servo
s1 = Servo(1) # P7
s2 = Servo(2) # P8
s1.pulse_width(1300)
s2.pulse_width(700)
sensor.reset() # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000) # Wait for settings take effect.
clock = time.clock() # Create a clock object to track the FPS.
while(True):
for i in range(5):
time.sleep(2000)
clock.tick()
s2.pulse_width(700 + 425*i)
while(sensor.snapshot()=False):
pass
img = sensor.snapshot()