示例#1
0
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)
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 = []
    for x in range(8):
        voltage = neoradio2.read_sensor_float(device, 0x00, x)
        ain_values.append(voltage)
        print("{}: {:.2f}V".format(names[x], voltage))
示例#3
0
    return sign + base36


if __name__ == "__main__":
    try:
        devices = neoradio2.find()
        # List all the devices connected to the computer
        print("Found {} Device(s)".format(len(devices)))
        for device in devices:
            print("\t1.) {} {}".format(device.name, device.serial_str))
        print()

        # Connect and identify all the chains
        for device in devices:
            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))