# pip install neoradio2 import neoradio2 import time def enable_device_io(device, io_mask, enable_mask=0xFF): # The second device bank 1 in the "chain" controls all the IO neoradio2.write_sensor(device, 1, 1, io_mask, enable_mask) if __name__ == "__main__": # Find all devices devices = neoradio2.find() if not len(devices): print("Failed to find any neoRAD-IO2 Devices!") exit(1) # Open first device print("Opening {} {}...".format(devices[0].name, devices[0].serial_str)) device = neoradio2.open(devices[0]) print("Opened {} {}...".format(devices[0].name, devices[0].serial_str)) # Make sure we are in application firmware and chain is identified. neoradio2.app_start(device, 0, 0xFF) neoradio2.chain_identify(device) # Read all the AIN values neoradio2.request_sensor_data(device, 0x00, 0xFF, True) names = ["AIN1", "AIN2", "AIN3", "AIN4", "AIN5", "AIN6", "TEMP", "POT "] ain_values = []
import os try: print(os.environ['PYTHONPATH'].split(os.pathsep)) finally: pass try: import neoradio2 except Exception as ex: input(str(ex)) import time if __name__ == "__main__": for device in neoradio2.find(): print("Opening {} {}...".format(device.name, device.serial_str)) handle = neoradio2.open(device) print("Opened {} {}...".format(device.name, device.serial_str)) try: while True: neoradio2.chain_identify(handle) s = time.time() #points = [1,1,1,1] header = neoradio2.neoRADIO2frame_calHeader() header.cr_is_bitmask = 0 header.channel = 0 header.range = 0 header.num_of_pts = 4 header.cal_type_size = 4 # sizeof(int) e = time.time() msg = str(e-s)