def run(self): last_bit_pattern = 0 while not self.stopped(): sleep(SENDER_DELAY) pin_bit_pattern = pfio.read_input() # if there is a change in the input pins changed_pins = pin_bit_pattern ^ last_bit_pattern if changed_pins: try: self.broadcast_changed_pins(changed_pins, pin_bit_pattern) except Exception as e: print e break last_bit_pattern = pin_bit_pattern
def get_switch_values(self): '''Returns the on/off states of the switches. 1 is on 0 is off''' return pfio.read_input() & 0x0f