import time import BaseHTTPServer from SocketServer import ThreadingMixIn from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer import SimpleHTTPServer import buttonIncrementor # import driveMacCamera import drivePiCamera import pigpio import io PORT = 8060 FPS = 24 axis1 = buttonIncrementor.buttonIncrementor() axis2 = buttonIncrementor.buttonIncrementor() piController = pigpio.pi() stream = protectedBytesIO.protectedBytesIO(io.BytesIO()) # camera = driveMacCamera.macCamera(stream) camera = drivePiCamera.piCamera(stream) class TestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): if self.path.endswith('cam.mjpg'): print "handling cam.mjpgl.." self.send_response(200) self.send_header('Content-type', 'multipart/x-mixed-replace; boundary=--jpgboundary') self.end_headers() while True:
import SimpleHTTPServer import buttonIncrementor # available camera selection stream = protectedBytesIO.protectedBytesIO(io.BytesIO()) try: import drivePiCamera camera = drivePiCamera.piCamera(stream) except ImportError: import driveCvCamera camera = driveCvCamera.cvCamera(stream) PORT = 8060 FPS = 24 axis1 = buttonIncrementor.buttonIncrementor() axis2 = buttonIncrementor.buttonIncrementor() try: # pi enviroment import pigpio piController = pigpio.pi() except ImportError: # non-pi enviroment # FIXME : implemnt some virtual devices pass class TestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): if self.path.endswith('cam.mjpg'):
from time import sleep import pigpio import pygame import joystickCommandPack import objectTransmission import buttonIncrementor receiver = objectTransmission.objReceiver(('', 5001)) piController = pigpio.pi() __buttonIncrementor = buttonIncrementor.buttonIncrementor() __buttonIncrementor2 = buttonIncrementor.buttonIncrementor() while 1: # print receiver.recvfrom() pack = receiver.recvfrom() # piController.set_servo_pulsewidth(21, (pack.axisValues[0]+1) * 750 + 750) # piController.set_PWM_dutycycle(18, (pack.axisValues[3]+1) * 125) # piController.set_servo_pulsewidth(18, pack.axis2Servo()[0]) # piController.set_servo_pulsewidth(21, pack.axis2Servo()[1]) # piController.hardware_PWM(19, 100, pack.axis2Pwm()[2]) if pack.buttonValues[0] == 1: __buttonIncrementor.move(True) if pack.buttonValues[1] == 1: __buttonIncrementor.move(False) piController.set_servo_pulsewidth(16, __buttonIncrementor.currentPosition) if pack.buttonValues[2] == 1: __buttonIncrementor2.move(True) if pack.buttonValues[3] == 1: __buttonIncrementor2.move(False) piController.set_servo_pulsewidth(20, __buttonIncrementor2.currentPosition) print pack