Servo sweep + Video record HELP!

Hey all,

We’re in the last week of robotics camp. I want to do a servo sweep while recording video. I can’t get them to go at the same time. Can anyone help? Here’s my code (you can’t see the indents, but syntax is fine):

def fullsweep():
for x in range (0, 1):
with picamera.PiCamera() as camera:
print "Taking video"
for i in range(180):
print i
with picamera.PiCamera() as camera:
print ‘Voltage:’,volt()

For the servo to do the sweep and the camera to record the video at the same time, you would have to do multithreading so that the two processes can tun in parallel. You should be able to find some tutorials to help you getting the threads to work. Another thing that might work for you is to use two different programs, one to run the servo and the other to record the video and run them from two different SSH/VNC sessions.