예제 #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'
    })
])

# Store the delay settings above into the logfile for posterity.
예제 #2
0
if __name__ == '__main__':

    globalFunctions.banner()
    devices = []

    # I2C setup
    found = i2cDevice.scan_for_devices(bus=1)
    devices = i2cDevice.load_i2c_devices(found)
    if len(devices) == 0:
        cprint("No I2C devices found.", 'red', attrs=['bold'])

    # USB setup
    usbDevicesFound = usbDevice.search_for_usb_devices(debugMode=True)
    special_args = {'debugMode': True, 'live_preview': True, 'quiet': False}
    devices.extend(usbDevice.load_usb_devices(usbDevicesFound, **special_args))

    # Serial device on the Pi's UART
    from pyLabDataLogger.device import serialDevice
    devices.append(
        serialDevice.serialDevice({
            'driver': 'serial/hpma',
            'port': '/dev/serial0'
        }))

    try:
        while True:
            for d in devices:
                cprint(d.name, 'magenta', attrs=['bold'])
                d.query()
                d.pprint()