Пример #1
0
def ArdReset():
    if CF.Debug > 0:
        print("send reset signal to arduino")
    SC.DropPort(CF.Devices[0][0])
    GPIO.output(CF.GPIOPins[0], False)
    time.sleep(0.1)
    GPIO.output(CF.GPIOPins[0], True)
    time.sleep(1.5)
    SC.InitPort()

    response = None
    while response != "Ready":
        if CF.Debug > 0:
            print("waiting Arduino boot")
        SC.DropPort(CF.Devices[0][0])
        SC.InitPort()
        time.sleep(2)
        response = SC.ReadComand(CF.Devices[0][0])
        if (response != None):
            response = response[:-4]
        SC.SendComand("p", CF.Devices[0][0])
        print(response)
    if CF.Debug > 0:
        print("reset complete")
Пример #2
0
def ForwardMoving(Speed, Turn):  #принимаем скорость и обороты колеса
    Direction = ['1', '1', '1', '1']
    comand = BuildMovingComand(Speed, Turn, Direction)
    SC.SendComand(comand, MovingArduino)
    if CF.Debug > 0:
        print(comand)
Пример #3
0
def TurnLeftMoving(Speed, Turn):
    Direction = ['0', '1', '0', '1']
    comand = BuildMovingComand(Speed, Turn, Direction)
    SC.SendComand(comand, MovingArduino)
    if CF.Debug > 0:
        print(comand)
Пример #4
0
def BackRightMoving(Speed, Turn):
    Direction = ['2', '0', '0', '2']
    comand = BuildMovingComand(Speed, Turn, Direction)
    SC.SendComand(comand, MovingArduino)
    if CF.Debug > 0:
        print(comand)