Пример #1
0
def openOnly(servo_index):
    global filter_states

    states = filter_default_states.copy()
    states[servo_index] = not states[servo_index]
    servo.setServos(states)
    filterstates = states
Пример #2
0
def close(servo_index):
    global filter_states

    if filter_states[servo_index] == False:
        return
    filter_states[servo_index] = False
    servo.setServos({servo_index: False})
Пример #3
0
def open(servo_index):
    global filter_states

    if filter_states[servo_index] == True:
        return
    filter_states[servo_index] = True
    servo.setServos({servo_index: True})
Пример #4
0
def init():
    global filter_default_states
    global filter_states

    for i in range(0, servo.SERVO_TRANSMISSION_SIZE):
        filter_default_states[i] = (
            (i % 2) == 0)  # switch between open & closed as default states
        filter_states[i] = False

    servo.setServos(filter_default_states)
Пример #5
0
def closeAll():
    global filter_states

    servo.setServos(filter_default_states)
    for i in range(0, servo.SERVO_TRANSMISSION_SIZE):
        filter_states[i] = False
Пример #6
0
def toggle(servo_index):
    global filter_states

    filter_states[servo_index] = not filter_states[servo_index]
    servo.setServos({servo_index: filter_states[servo_index]})