def openOnly(servo_index): global filter_states states = filter_default_states.copy() states[servo_index] = not states[servo_index] servo.setServos(states) filterstates = states
def close(servo_index): global filter_states if filter_states[servo_index] == False: return filter_states[servo_index] = False servo.setServos({servo_index: False})
def open(servo_index): global filter_states if filter_states[servo_index] == True: return filter_states[servo_index] = True servo.setServos({servo_index: True})
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)
def closeAll(): global filter_states servo.setServos(filter_default_states) for i in range(0, servo.SERVO_TRANSMISSION_SIZE): filter_states[i] = False
def toggle(servo_index): global filter_states filter_states[servo_index] = not filter_states[servo_index] servo.setServos({servo_index: filter_states[servo_index]})