示例#1
0
def simplereceive():
#    received=1
#    while receive != 0:
     ctm = ComToMatrix()
     while 1:
        x = ser.readline(4) 
        if x == 'forw':
           print 'Moving forward'
           ctm.set_Forw()         
        elif x == 'back':
           print 'Moving backwards'
           ctm.set_Back()         
        elif x == 'left':
           ctm.set_Left()         
           print 'Moving left'
        elif x == 'righ':
           ctm.set_Right()         
           print 'Moving right'
        elif x == 'fast':
           ctm.set_Plus()         
           print 'Moving faster'
        elif x == 'slow':
           ctm.set_Min()         
           print 'Moving slower'
        elif x == 'dead':
           ctm.set_Dead()         
           print 'Drop dead'
示例#2
0
def simplereceive():
#    received=1
#    while receive != 0:
     ctm = ComToMatrix()
     while 1:
        x = ser.readline(4) 
        if x == 'forw':
           print 'Moving forward'
           ctm.set_Forw()         
        elif x == 'back':
           print 'Moving backwards'
           ctm.set_Back()         
        elif x == 'left':
           ctm.set_Left()         
           print 'Moving left'
        elif x == 'righ':
           ctm.set_Right()         
           print 'Moving right'
        elif x == 'fast':
           ctm.set_Plus()         
           print 'Moving faster'
        elif x == 'slow':
           ctm.set_Min()         
           print 'Moving slower'
        elif x == 'dead':
           ctm.set_Dead()         
           print 'Drop dead'
        elif x == 'rese':
           ctm.set_Reset()         
        elif x == 'snd1': 
           os.system("python FFTSound1.py")
           simplereceive()
        elif x == 'snd2':
           os.system("python FFTSound2.py")
           simplereceive()
        elif x == 'snd3':
           os.system("python FFTSound3.py")
           simplereceive()    
        elif x == 'snd4':
           os.system("python FFTSound4.py")
           simplereceive()
        elif x == 'audi':
           ReadParameters()