Example #1
0
def set_engine(direction: int):
    if direction == 0:
        halduino.setSpeedEngines(0, 0)
        print('STOP!')
    elif direction == 1:
        halduino.setSpeedEngines(100, 100)
        print('Forward')
def loop():
    if halduino.getLineFollowValue() == 0:
        halduino.setSpeedEngines(100, 100)
    elif halduino.getLineFollowValue() == 1:
        halduino.setSpeedEngines(0, 100)
    elif halduino.getLineFollowValue() == 2:
        halduino.setSpeedEngines(100, 0)
    elif halduino.getLineFollowValue() == 3:
        halduino.setSpeedEngines(-100, -100)
def set_engine(direction: int):
    if direction == 0:
        halduino.setSpeedEngines(0, 0)
        sleep(500)
        halduino.playBuzzer(330, 1000)
        halduino.setSpeedEngines(-100, -100)
        sleep(500)
        halduino.setSpeedEngines(100, 0)
        sleep(1200)
    elif direction == 1:
        halduino.setSpeedEngines(100, 100)
Example #4
0
def set_engine(direction: int):
    if direction == 0:
        halduino.setSpeedEngines(0, 0)
        sleep(500)
        halduino.setSpeedEngines(-100, -100)
        sleep(500)
        halduino.setSpeedEngines(100, 0)
        sleep(100)
        print('Rotate!')
    elif direction == 1:
        halduino.setSpeedEngines(100, 100)
        print('Forward')
def loop():
    if halduino.getIR3() < 300:
        halduino.setSpeedEngines(110, 110)
    if halduino.getIR2() < 300:
        halduino.setSpeedEngines(110, 0)
    if halduino.getIR4() < 300:
        halduino.setSpeedEngines(0, 110)