Using RPIO PWM and os.subsystem - failing
Posted: Fri Feb 21, 2014 4:42 pm
I'm trying to build a pan and tilt camera using 2 servos and a webcam. The servos are attached directly to pins 23 and 24. Raspberry model A, Logitiech webcam, USB wifi.
When I try using RPIO PWM and os.system in the same script, the os.system part runs correctly, but the script basically shuts down after.
If I rem out the servo commands the os.system runs correctly and the script completes
I've tried various ways of running commands within Python but seem to get the same result. Have tried a fresh install of raspbian, also tried a model B.
Any thoughts?
With Servo lines
With servo lines removed:-
I've tried using a Raspberry Pi cam and raspistill but same issue. Managed to get the native Python Camera module working with the PWM code but want to use webcam.
When I try using RPIO PWM and os.system in the same script, the os.system part runs correctly, but the script basically shuts down after.
If I rem out the servo commands the os.system runs correctly and the script completes
I've tried various ways of running commands within Python but seem to get the same result. Have tried a fresh install of raspbian, also tried a model B.
Any thoughts?
Code: Select all
#!/usr/bin/env python
import time
import os
import ftplib
from RPIO import PWM
servo = PWM.Servo()
intPan = 600
intTilt = 1300
strPicName = "webcam"
strTempFilename = "/home/pi/" + strPicName + "Temp.jpg"
strFilename = "/home/pi/" + strPicName + ".jpg"
#print("############################## Pan and Tilt")
#servo.set_servo(23, intTilt)
#servo.set_servo(24, intPan)
time.sleep( 2 )
print("############################## Taking Photo")
os.system("fswebcam -d /dev/video0 -r 384x288 " + strFilename)
print("Finished")
print("############################## resetting")
servo.stop_servo(23)
servo.stop_servo(24)Code: Select all
--- Processing captured image...
Writing JPEG image to '/home/pi/webcam.jpg'.
shutting down dma channel 0
clear_channel: channel=0
Code: Select all
--- Processing captured image...
Writing JPEG image to '/home/pi/webcam.jpg'.
Finished
############################## resetting