Exemple #1
0
                    print("Reading Calibration {} {}...".format(device.name, device.serial_str))
                    cal = neoradio2.read_calibration_array(handle, 0, x, header)
                    print(x, cal)
                    #time.sleep(0.05)
                    print("Reading Calibration Points {} {}...".format(device.name, device.serial_str))
                    cal_points = neoradio2.read_calibration_points_array(handle, 0, x, header)
                    print(x, cal_points)
                    time.sleep(0.05)
                    

                time.sleep(1)
        except Exception as ex:
            print(ex)
            time.sleep(1)
        finally:
            neoradio2.close(handle)
            input("Press any key to continue...")

"""
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 = [ -50, 0, 75, 650 ]
                cal = [ -48.67, 1.19, 75.72, 650.36 ]
    # 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 = []
    for x in range(8):
        voltage = neoradio2.read_sensor_float(device, 0x00, x)
        ain_values.append(voltage)
        print("{}: {:.2f}V".format(names[x], voltage))

    neoradio2.close(device)
Exemple #3
0
            print_status(device, "Connecting")
            h = neoradio2.open(device)
            print_status(device, "Connected")

            print_status(device, "Identifying Chain")
            neoradio2.chain_identify(h)

            print_status(device, "Starting App")
            neoradio2.app_start(h, 0xFF, 0xFF)

            print_status(device, "Identifying Chain")
            neoradio2.chain_identify(h)

            count = neoradio2.get_chain_count(h, False)
            print_status(device,
                         "Found {} device(s) in the chain".format(count))

            for d in range(count):
                dev_type = neoradio2.get_device_type(h, d, 0)
                serial_number = neoradio2.get_serial_number(h, d, 0)
                print("\tChain {} {} {}".format(d + 1,
                                                device_type_string(dev_type),
                                                base36encode(serial_number)))

            print_status(device, "Closing")
            neoradio2.close(h)
    except Exception as ex:
        print(ex)
    finally:
        input("Press any key to continue...")