def enc_button_callback(): print ("Encoder button press HIGH") lyra_mapper.updateSignal(5, libm_enc_button_val)
def button_callback(): print ("Button press HIGH") lyra_mapper.updateSignal(1, libm_button_val)
def switch2_callback(): print ("Switch 2 state change HIGH") lyra_mapper.updateSignal(3, libm_switch2_val)
# libm_button_val = read_button() # write_led(libm_button_val) # if DEBUG: # print "Button State: ", libm_button_val # libm_switch_val = read_switch() # if DEBUG: # print "Switch State: ", libm_switch_val # ====================================== # ROTARY ENCODER READING # ====================================== libm_encoder_val = read_encoder() if libm_encoder_val != 0: lyra_mapper.updateSignal(4, libm_encoder_val) if DEBUG: if libm_encoder_val != 0: print "Encoder Direction: ", libm_encoder_val # ====================================== # MCP3008 ADC READING # ====================================== # we'll assume that the pot didn't move libm_sensor0_val_changed = False # read the analog pin libm_sensor0_val = read_adc(sensor0_adc_pin, SPICLK, SPIMOSI, SPIMISO, SPICS) # how much has it changed since the last read? sensor0_adjust = abs(libm_sensor0_val - adc_last_state)