# Import the UE9 module import ue9 # Open first found UE9 d = ue9.UE9() # Read calibration information from the UE9 for following analog input # conversions. d.getCalibrationData() # Update FIO0-1 as digital inputs and FIO2-3 as output-high. fio_mask = 15 # FIO lines to update (b1 = update, b0 = don't update) = b00001111 = d15 fio_dir = 12 # FIO directions (b1 = output, b0 = input) = b00001100 = d12 fio_state = 12 # FIO state (b1 = high, b0 = low) = b00001100 = d15 results = d.feedback(FIOMask=fio_mask, FIODir=fio_dir, FIOState=fio_state) # Display FIOState (decimal, all FIOs) print(results["FIOState"]) # Read AIN0 and AIN1 ain_mask = 3 # AIN channels to read = b0000000000000011 = d3 resolution = 12 # Resolution = 12 settling_time = 0 # Settling time = 0 ain1_0_bipgain = 8 # AIN0 and AIN1 gain = 8 = bipolar gain 1 = +/-5 V results = d.feedback(AINMask=ain_mask, Resolution=resolution, SettlingTime=settling_time, AIN1_0_BipGain=ain1_0_bipgain) # Display AIN0 and AIN1 reading (in volts) print("%f , %f" % (results["AIN0"], results["AIN1"])) # Note that the above 2 feedback commands can be done in one call # Feedback settings are documented here: # https://labjack.com/support/datasheets/ue9/low-level-function-reference/control-functions/feedback print("Done")