def __init__(self,w):
       threading.Thread.__init__(self)
       self.rotX = 0
       self.rotY = 0
       self.rotZ = 0
       self.window = w
       self.sigue=True
       #iniciar Wiimote
       self.nmotes = 1
       self.wiimotes = wiiuse.init(self.nmotes)
       found = wiiuse.find(self.wiimotes, self.nmotes, 5)
       if not found:
             print 'not found'
             sys.exit(1)
       connected = wiiuse.connect(self.wiimotes, self.nmotes)
       if connected:
             print 'Connected to %i wiimotes (of %i found).' % (connected, found)
       else:
             print 'failed to connect to any wiimote.'
             sys.exit(1)
       for i in range(self.nmotes):
             wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
             wiiuse.status(self.wiimotes[0])
             wiiuse.set_ir(self.wiimotes[0], 1)
             wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
       wiiuse.rumble(self.wiimotes[0], 10)
       time.sleep(0.1)
       wiiuse.rumble(self.wiimotes[0], 0)
       self.wm = self.wiimotes[0][0]
 def __init__(self):
     super(Grafico, self).__init__()
     self.l1=0
     self.l2=0
     self.l3=0
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected, found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.5)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
 def __init__(self, parent=None):
     self.parent = parent
     QtOpenGL.QGLWidget.__init__(self, parent)
     self.xRotDeg = 0.0
     self.yRotDeg = 0.0
     self.zRotDeg = 0.0
     #######iniciando Wiiii
     #####################
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected, found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.5)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
Beispiel #4
0
 def __init__(self, w):
     threading.Thread.__init__(self)
     self.rotX = 0
     self.rotY = 0
     self.rotZ = 0
     self.IRX = 0
     self.IRY = 0
     self.window = w
     self.sigue = True
     self.releasedButton = {
         "1": "2",
         "2": "1",
         "16": "-",
         "128": "HOME",
         "4096": "+",
         "8": "A",
         "1024": "ABAJO",
         "512": "DERECHA",
         "2048": "ARRIBA",
         "256": "IZQUIERDA",
         "4": "B",
         "3": "1+2"
     }
     self.pressedButton = {
         "2.86": "ARRIBA",
         "1.43": "ABAJO",
         "7.17": "DERECHA",
         "3.58": "IZQUIERDA",
         "1.12": "A",
         "5.60": "B",
         "2.24": "-",
         "1.79": "HOME",
         "5.73": "+",
         "2.80": "1",
         "1.40": "2",
         "2.75": "1+2"
     }
     #iniciar Wiimote
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected,
                                                            found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.1)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
 def __init__(self,w):
       threading.Thread.__init__(self)
       self.rotX = 0
       self.rotY = 0
       self.rotZ = 0
       self.window = w
       self.sigue=True
       self.releasedButton ={"1":"2","2":"1","16":"-","128":"HOME","4096":"+","8":"A","1024":"ABAJO",
                             "512":"DERECHA","2048":"ARRIBA","256":"IZQUIERDA","4":"B","3":"1+2"}
       self.pressedButton  ={"2.86":"ARRIBA","1.43":"ABAJO","7.17":"DERECHA","3.58":"IZQUIERDA","1.12":"A",
                             "5.60":"B","2.24":"-","1.79":"HOME","5.73":"+","2.80":"1","1.40":"2","2.75":"1+2"}
       #iniciar Wiimote
       self.nmotes = 1
       self.wiimotes = wiiuse.init(self.nmotes)
       found = wiiuse.find(self.wiimotes, self.nmotes, 5)
       if not found:
             print 'not found'
             sys.exit(1)
       connected = wiiuse.connect(self.wiimotes, self.nmotes)
       if connected:
             print 'Connected to %i wiimotes (of %i found).' % (connected, found)
       else:
             print 'failed to connect to any wiimote.'
             sys.exit(1)
       for i in range(self.nmotes):
             wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
             wiiuse.status(self.wiimotes[0])
             wiiuse.set_ir(self.wiimotes[0], 1)
             wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
       wiiuse.rumble(self.wiimotes[0], 10)
       time.sleep(0.1)
       wiiuse.rumble(self.wiimotes[0], 0)
       self.wm = self.wiimotes[0][0]
 def __init__(self, parent=None):
     self.parent = parent
     QtOpenGL.QGLWidget.__init__(self, parent)
     self.xRotDeg = 0.0
     self.yRotDeg = 0.0
     self.zRotDeg = 0.0
     #######iniciando Wiiii
     #####################
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected,
                                                            found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.5)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
Beispiel #7
0
def init():
    if os.name != 'nt': print 'Press 1&2'

    wiimotes = wiiuse.init(nmotes)

    found = wiiuse.find(wiimotes, nmotes, 5)
    if not found:
        print 'not found'
        sys.exit(1)

    connected = wiiuse.connect(wiimotes, nmotes)
    if connected:
        print 'Connected to %i wiimotes (of %i found).' % (connected, found)
    else:
        print 'failed to connect to any wiimote.'
        sys.exit(1)

    for i in range(nmotes):
        wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
        wiiuse.status(wiimotes[0])
        wiiuse.set_ir(wiimotes[0], 1)
        wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)

    try:
        rum = 1
        while True:
            r = wiiuse.poll(wiimotes, nmotes)
            if r != 0:
                handle_event(wiimotes[0])
    except KeyboardInterrupt:
        for i in range(nmotes):
            wiiuse.set_leds(wiimotes[i], 0)
            wiiuse.rumble(wiimotes[i], 0)
            wiiuse.disconnect(wiimotes[i])
 def __init__(self, w):
     threading.Thread.__init__(self)
     self.rotX = 0
     self.rotY = 0
     self.rotZ = 0
     self.window = w
     self.sigue = True
     #iniciar Wiimote
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected,
                                                            found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.1)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
Beispiel #9
0
def init():
    if os.name != 'nt': print 'Press 1&2'

    wiimotes = wiiuse.init(nmotes)

    found = wiiuse.find(wiimotes, nmotes, 5)
    if not found:
        print 'not found'
        sys.exit(1)

    connected = wiiuse.connect(wiimotes, nmotes)
    if connected:
        print 'Connected to %i wiimotes (of %i found).' % (connected, found)
    else:
        print 'failed to connect to any wiimote.'
        sys.exit(1)

    for i in range(nmotes):
        wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
        wiiuse.status(wiimotes[0])
        wiiuse.set_ir(wiimotes[0], 1)
        wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)

    try:
        rum = 1
        while True:
            r = wiiuse.poll(wiimotes, nmotes)
            if r != 0:
                handle_event(wiimotes[0])
    except KeyboardInterrupt:
        for i in range(nmotes):
            wiiuse.set_leds(wiimotes[i], 0)
            wiiuse.rumble(wiimotes[i], 0)
            wiiuse.disconnect(wiimotes[i])
 def __init__(self):
     super(Grafico, self).__init__()
     self.maxG1 =1.0
     self.maxG2 =1.0
     self.maxG3 =1.0
     self.minG1 =-1.0
     self.minG2 =-1.0
     self.minG3 =-1.0
     self.b1 = True
     self.b2 = True
     self.b3 = True
     self.l1 = None
     self.l2 = None
     self.l3 = None
     self.arr = [0 for i in range(0,350)]
     self.arr1 = [0 for i in range(0,350)]
     self.arr2 = [0 for i in range(0,350)]
     #######iniciando Wiiii
     #####################
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected, found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.5)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
     #wiiuse.motion_sensing(self.wiimotes, 0)
     ###############################
     #######iniciando wii
     ###iniciando hilos
     self.hilo = Wiibotones(self)
     self.hilo.start()
     #################
     
     """super(Example, self).__init__()
Beispiel #11
0
 def __init__(self):
     super(Grafico, self).__init__()
     self.maxG1 = 1.0
     self.maxG2 = 1.0
     self.maxG3 = 1.0
     self.minG1 = -1.0
     self.minG2 = -1.0
     self.minG3 = -1.0
     self.b1 = True
     self.b2 = True
     self.b3 = True
     self.l1 = None
     self.l2 = None
     self.l3 = None
     self.arr = [0 for i in range(0, 350)]
     self.arr1 = [0 for i in range(0, 350)]
     self.arr2 = [0 for i in range(0, 350)]
     #######iniciando Wiiii
     #####################
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected,
                                                            found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     wiiuse.rumble(self.wiimotes[0], 10)
     time.sleep(0.5)
     wiiuse.rumble(self.wiimotes[0], 0)
     self.wm = self.wiimotes[0][0]
     #wiiuse.motion_sensing(self.wiimotes, 0)
     ###############################
     #######iniciando wii
     ###iniciando hilos
     self.hilo = Wiibotones(self)
     self.hilo.start()
     #################
     """super(Example, self).__init__()
 def run(self):
     #iniciar Wiimote
     self.nmotes = 1
     self.wiimotes = wiiuse.init(self.nmotes)
     found = wiiuse.find(self.wiimotes, self.nmotes, 5)
     if not found:
         print 'not found'
         sys.exit(1)
     connected = wiiuse.connect(self.wiimotes, self.nmotes)
     if connected:
         print 'Connected to %i wiimotes (of %i found).' % (connected,
                                                            found)
     else:
         print 'failed to connect to any wiimote.'
         sys.exit(1)
     for i in range(self.nmotes):
         wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
         wiiuse.status(self.wiimotes[0])
         wiiuse.set_ir(self.wiimotes[0], 1)
         wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
     """wiiuse.rumble(self.wiimotes[0], 10)
         time.sleep(0.1)
         wiiuse.rumble(self.wiimotes[0], 0)"""
     for i in range(4):
         wiiuse.set_leds(self.wiimotes[0], wiiuse.LED[3 - i])
         time.sleep(0.2)
     self.wm = self.wiimotes[0][0]
     #iniciar Wiimote
     while self.sigue:
         wiiuse.motion_sensing(self.wiimotes, self.nmotes)
         wiiuse.poll(self.wiimotes, self.nmotes)
         print wiiuse.using_acc(self.wm)
         print "gforce \t" + str(self.wm.gforce.x)
         print "gforce \t" + str(self.wm.gforce.y)
         print "gforce \t" + str(self.wm.gforce.z)
         print "accel \t" + str(self.wm.accel.x)
         print "orient \t" + str(self.wm.orient.roll)
         print "orient \t" + str(self.wm.orient.pitch)
         print "orient \t" + str(self.wm.orient.yaw)
         print "accel_calib \t" + str(self.wm.accel_calib.cal_g.x)
         print "state \t" + str(self.wm.state)
         print "lstate\t" + str(self.wm.lstate.orient.roll)
         print "lstate\t" + str(self.wm.lstate.orient.pitch)
         print "lstate\t" + str(self.wm.lstate.orient.yaw)
         print "#" * 30
         time.sleep(0.1)
 def run(self):
       #iniciar Wiimote
       self.nmotes = 1
       self.wiimotes = wiiuse.init(self.nmotes)
       found = wiiuse.find(self.wiimotes, self.nmotes, 5)
       if not found:
             print 'not found'
             sys.exit(1)
       connected = wiiuse.connect(self.wiimotes, self.nmotes)
       if connected:
             print 'Connected to %i wiimotes (of %i found).' % (connected, found)
       else:
             print 'failed to connect to any wiimote.'
             sys.exit(1)
       for i in range(self.nmotes):
             wiiuse.set_leds(self.wiimotes[i], wiiuse.LED[i])
             wiiuse.status(self.wiimotes[0])
             wiiuse.set_ir(self.wiimotes[0], 1)
             wiiuse.set_ir_vres(self.wiimotes[i], 1000, 1000)
       """wiiuse.rumble(self.wiimotes[0], 10)
       time.sleep(0.1)
       wiiuse.rumble(self.wiimotes[0], 0)"""
       for i in range(4):
             wiiuse.set_leds(self.wiimotes[0], wiiuse.LED[3-i])
             time.sleep(0.2)
       self.wm = self.wiimotes[0][0]
       #iniciar Wiimote
       while self.sigue:
             wiiuse.motion_sensing(self.wiimotes, self.nmotes)
             wiiuse.poll(self.wiimotes, self.nmotes)
             print wiiuse.using_acc(self.wm)
             print "gforce \t"+str(self.wm.gforce.x)
             print "gforce \t"+str(self.wm.gforce.y)
             print "gforce \t"+str(self.wm.gforce.z)
             print "accel \t"+str(self.wm.accel.x)
             print "orient \t"+str(self.wm.orient.roll)
             print "orient \t"+str(self.wm.orient.pitch)
             print "orient \t"+str(self.wm.orient.yaw)
             print "accel_calib \t"+str(self.wm.accel_calib.cal_g.x)
             print "state \t"+str(self.wm.state)
             print "lstate\t"+str(self.wm.lstate.orient.roll)
             print "lstate\t"+str(self.wm.lstate.orient.pitch)
             print "lstate\t"+str(self.wm.lstate.orient.yaw)
             print "#"*30
             time.sleep(0.1)
def getConnected():
    #global wiimotes
    #wiimotes = wiiuse.init(nmotes)
    found = wiiuse.find(wiimotes, nmotes, 5)
    if not found:
        print 'not found'
        sys.exit(1)
    connected = wiiuse.connect(wiimotes, nmotes)
    if connected:
        print 'Connected to %i wiimotes (of %i found).' % (connected, found)
    else:
        print 'failed to connect to any wiimote.'
        sys.exit(1)

    for i in range(nmotes):
        wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
        wiiuse.status(wiimotes[0])
        wiiuse.set_ir(wiimotes[0], 1)
        wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)
def getConnected():
    #global wiimotes
    #wiimotes = wiiuse.init(nmotes)
    found = wiiuse.find(wiimotes, nmotes, 5)
    if not found:
        print 'not found'
        sys.exit(1)
    connected = wiiuse.connect(wiimotes, nmotes)
    if connected:
        print 'Connected to %i wiimotes (of %i found).' % (connected, found)
    else:
        print 'failed to connect to any wiimote.'
        sys.exit(1)

    for i in range(nmotes):
        wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
        wiiuse.status(wiimotes[0])
        wiiuse.set_ir(wiimotes[0], 1)
        wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)
Beispiel #16
0
def connect():
    if os.name != 'nt': print 'Press 1&2'

    wiimotes = wiiuse.init(nmotes)

    found = wiiuse.find(wiimotes, nmotes, 5)
    if not found:
        st='not found'
        print st
        return st
    connected = wiiuse.connect(wiimotes, nmotes)
    if connected:
        print 'Connected to %i wiimotes (of %i found).' % (connected, found)
    else:
        print 'failed to connect to any wiimote.'
        sys.exit(1)

    for i in range(nmotes):
        wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
        wiiuse.status(wiimotes[0])
        wiiuse.set_ir(wiimotes[0], 1)
        wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)
    
    return wiimotes,nmotes
Beispiel #17
0
if not found:
    print 'not found'
    sys.exit(1)

connected = wiiuse.connect(wiimotes, nmotes)
if connected:
    print 'Connected to %i wiimotes (of %i found).' % (connected, found)
else:
    print 'failed to connect to any wiimote.'
    sys.exit(1)

for i in range(nmotes):
    wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
    wiiuse.status(wiimotes[0])
    wiiuse.set_ir(wiimotes[0], 1)
    wiiuse.set_ir_vres(wiimotes[i], 500, 500)

import serial
ser = serial.Serial()
ser.port = "/dev/ttyUSB0"  # may be called something different
ser.baudrate = 9600  # may be different
ser.open()
print "initialized Serial Controller"


def signal(w):

    if ser.isOpen():
        cmd = chr(int(w.yaw)) + chr(int(w.pitch)) + chr(int(w.throttle)) + chr(
            int(w.yawCorrect))
        ser.write(cmd)
Beispiel #18
0
#######iniciando Wiiii
####################
nmotes = 1
wiimotes = wiiuse.init(nmotes)
found = wiiuse.find(wiimotes, nmotes, 5)
if not found:
    print 'not found'
    sys.exit(1)
connected = wiiuse.connect(wiimotes, nmotes)
if connected:
    print 'Connected to %i wiimotes (of %i found).' % (connected, found)
else:
    print 'failed to connect to any wiimote.'
    sys.exit(1)
for i in range(nmotes):
    wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
    wiiuse.status(wiimotes[0])
    wiiuse.set_ir(wiimotes[0], 1)
    wiiuse.set_ir_vres(wiimotes[i], 1000, 1000)
wiiuse.rumble(wiimotes[0], 10)
time.sleep(0.1)
wiiuse.rumble(wiimotes[0], 0)
wm = wiimotes[0][0]
while True:
    wiiuse.motion_sensing(wiimotes,nmotes)
    wiiuse.poll(wiimotes, nmotes)
    print wm.ir.num_dots
    print wm.ir.x
    print wm.ir.y
    print "##"
Beispiel #19
0
if not found:
    print 'not found'
    sys.exit(1)

connected = wiiuse.connect(wiimotes, nmotes)
if connected:
    print 'Connected to %i wiimotes (of %i found).' % (connected, found)
else:
    print 'failed to connect to any wiimote.'
    sys.exit(1)

for i in range(nmotes):
    wiiuse.set_leds(wiimotes[i], wiiuse.LED[i])
    wiiuse.status(wiimotes[0])
    wiiuse.set_ir(wiimotes[0], 1)
    wiiuse.set_ir_vres(wiimotes[i], 500, 500)



import serial
ser = serial.Serial()
ser.port = "/dev/ttyUSB0" # may be called something different
ser.baudrate = 9600 # may be different
ser.open()
print "initialized Serial Controller"

        
def signal(w):

    if ser.isOpen():
        cmd = chr(int(w.yaw)) + chr(int(w.pitch)) +chr(int(w.throttle)) + chr(int(w.yawCorrect))