示例#1
0
                #print('[A B C D : X Y] = [' + str(btn[0]) + ' ' + str(btn[1]) + ' ' + str(btn[2]) + ' ' + str(btn[3]) + ' : ' + str(dxax) + ' ' + str(dyax)+ ']')
            elif dtyp == '11':
                #print('Idle')
                val = ser.read()
                val = ser.read()
    if dxax > 8 and dxax_old <= 8:
        gb.move_stepper(BOARD_A, STEPPER_A, -20000)
        print('Forward')
    elif dxax < -8 and dxax_old >= -8:
        gb.move_stepper(BOARD_A, STEPPER_A, 20000)
        print('Backword')
    elif abs(dxax) <= 8 and abs(dxax_old) > 8:
        gb.stop_stepper(BOARD_A, STEPPER_A, 1)
        print('Stop')
    if dyax > 8 and dyax_old <= 8:
        gb.move_stepper(BOARD_B, STEPPER_B, -20000)
        gb.move_stepper(BOARD_B, STEPPER_C, 20000)
        print('Left')
    elif dyax < -8 and dyax_old >= -8:
        gb.move_stepper(BOARD_B, STEPPER_B, 20000)
        gb.move_stepper(BOARD_B, STEPPER_C, -20000)
        print('Right')
    elif abs(dyax) <= 8 and abs(dyax_old) > 8:
        gb.stop_stepper(BOARD_B, STEPPER_B, 1)
        gb.stop_stepper(BOARD_B, STEPPER_C, 1)
        print('Stop')
    dxax_old = dxax
    dyax_old = dyax

gb.emergency_stop()
示例#2
0
文件: motor.py 项目: oatmeal3000/qupy
 def shutDownAll(self):
     gb.emergency_stop()
示例#3
0
文件: rover.py 项目: oatmeal3000/qupy
     gb.move_brushed(BOARD,RIGHT,BACKW) # Right backwards 

  if key==ord('3') : 
     gb.move_brushed(BOARD,RIGHT,BACKW) # Right backwards 

  if key==ord('4') :
     gb.move_brushed(BOARD,LEFT,STOP) # Left stop 

  if key==ord('5') : 
     gb.move_brushed(BOARD,LEFT,STOP)  # Left stop 
     gb.move_brushed(BOARD,RIGHT,STOP) # Right stop 

  if key==ord('6') :
     gb.move_brushed(BOARD,RIGHT,STOP) # Right stop 

  if key==ord('7') :
     gb.move_brushed(BOARD,LEFT,FORWD) # Left forwards 

  if key==ord('8') :
     gb.move_brushed(BOARD,LEFT,FORWD)  # Left forwards 
     gb.move_brushed(BOARD,RIGHT,FORWD) # Right forwards 

  if key==ord('9') :
     gb.move_brushed(BOARD,RIGHT,FORWD) # Right forwards 

# on exit stop everything
gb.emergency_stop()
# Set terminal behaviour normal again
curses.endwin()