コード例 #1
0
output_invert = [0, 0, 0, 0, 1, 0]
debounce_delay = 1.0  # min. time between triggers allowed
busy_indicator_pin = 21  # this pin will be low while the logger is working, ie for a "busy" status LED.
busy_indicator_inv = 1  # is the busy indicator high or low while working

# Device setup special initialization settings
special_args={'debugMode':False, 'init_tc08_config':['K','K','K','T','T','T','X','X'], 'quiet':True,\
             'init_tc08_chnames':['Cold Junction','K1','K2','K3','T4','T5','T6','420mA_P1','420mA_P2']}

# Loop counter can be set from the command line, otherwise zero
if len(sys.argv) < 2: loop_counter = 0
else: loop_counter = int(sys.argv[1])

#####################################################################################################################
# Detect USB devices for datalogging.
usbDevicesFound = usbDevice.search_for_usb_devices(debugMode=False)
devices = usbDevice.load_usb_devices(usbDevicesFound, **special_args)

# Detect I2C devices for datalogging.
i2CDevicesFound = i2cDevice.scan_for_devices()
if len(i2CDevicesFound) > 0:
    devices.extend(i2cDevice.load_i2c_devices(i2CDevicesFound, **special_args))

# detect TCPIP VISA devides for datalogging. (Delay Generator)
devices.extend([
    pyvisaDevice.pyvisaDevice({
        'resource': 'TCPIP0::192.168.0.123::INSTR',
        'driver': 'pyvisa/dg1000z'
    })
])
コード例 #2
0
    # GPIO pins setup
    gpioInputPins=(5,6,19,20,16,17,18)
    gpioInputPullup=(False,False,True,True,True,True,True) # pull up inputs
    gpioChannelNames=['TTLIn1','TTLIn2','HX Water low','Heating','But1','But2','But3']
    devices.append(gpioDevice.gpioDevice({'pins':gpioInputPins,'pup':gpioInputPullup,'channel_names':gpioChannelNames}))

    # I2C setup    
    found = i2cDevice.scan_for_devices()
    if len(found)==0: 
        print("No I2C devices found.")
    else:
        devices.extend(i2cDevice.load_i2c_devices(found, **special_args)) 
    
    
    # USB setup
    usbDevicesFound = usbDevice.search_for_usb_devices(debugMode=special_args['debugMode'])
    devices.extend(usbDevice.load_usb_devices(usbDevicesFound, **special_args))
    
    
    # Reporting loop
    try:
        while True:
            for d in devices:
                print(d.name)
                d.query()
                d.pprint()
            time.sleep(1)
    except KeyboardInterrupt:
        print("Stopped.")
    except:
        raise