def navigate(total_time): frame = 0 while frame < total_time: distances = ultrasonic_interface.reading() if distances['FL'] > 20 and distances['FR'] > 20 and distances['FL'] > 0 and distances['FR'] > 0: rc_interface.forward(100) else: rc_interface.backward(100) time.sleep(0.5) rc_interface.clockwise(150) time.sleep(1.2)
def clockwiseResponse(message): rc_interface.clockwise(int(message)) emit('server-message', {'data': "clockwise"})