Exemple #1
0
def rotate_until_stalled(speed):
    counter = 0
    motor_power(SPINNER, speed)
    previous = abs(get_motor_position_counter(SPINNER))
    while counter < 10:
        if abs(get_motor_position_counter(SPINNER)) == previous:
            counter += 1
        else:
            counter = 0
            previous = abs(get_motor_position_counter(SPINNER))
        msleep(10)
    freeze(SPINNER)
    clear_motor_position_counter(SPINNER)
Exemple #2
0
def _clear_ticks():  # Clears the motor ticks.
    clear_motor_position_counter(RMOTOR)
    clear_motor_position_counter(LMOTOR)
Exemple #3
0
def set_spinner_safe():
    clear_motor_position_counter(SPINNER)
Exemple #4
0
def wait_for_someone_to_rotate():
    display("please spin me back")
    clear_motor_position_counter(SPINNER)
    while abs(get_motor_position_counter(SPINNER)) < 350:
        pass
    display("good job")