Exemplo n.º 1
0
def initialize_sensors(info_config):
    """Do all setup operations necesary to get ready prior to recording data.
    """

    # Config data.
    pins_data = info_config['pins_data']

    pin_power = int(info_config['pin_power'])

    # Initialize GPIO.
    # dht22.SetupGpio()

    # Power up the sensors.
    if pin_power:
        dht22._pinMode(pin_power, dht22._OUTPUT)
        dht22._digitalWrite(pin_power, True)
        time.sleep(5)

    # Create data recording channels.
    channels, queue = sensors.start_channels(pins_data)

    ok = sensors.check_channels_ok(channels, verbose=True)

    if not ok:
        sensors.stop_channels(channels)
        raise ValueError('Data channels not ready.')

    # Done.
    return channels, queue
Exemplo n.º 2
0
def initialize_sensors(info_config):
    """Do all setup operations necesary to get ready prior to recording data.
    """

    # Config data.
    pins_data = info_config['pins_data']

    pin_power = int(info_config['pin_power'])

    # Initialize GPIO.
    # dht22.SetupGpio()

    # Power up the sensors.
    if pin_power:
        dht22._pinMode(pin_power, dht22._OUTPUT)
        dht22._digitalWrite(pin_power, True)
        time.sleep(5)

    # Create data recording channels.
    channels, queue = sensors.start_channels(pins_data)

    ok = sensors.check_channels_ok(channels, verbose=True)

    if not ok:
        sensors.stop_channels(channels)
        raise ValueError('Data channels not ready.')

    # Done.
    return channels, queue
Exemplo n.º 3
0
def finalize(channels, info_config):
    """
    Do all operations necesary to shutdown.
    """

    # Stop recording.
    if channels:
        sensors.stop_channels(channels)

    # Turn off the sensors.
    if info_config:
        if info_config['pin_power']:
            print('pin_power off')
            dht22._digitalWrite(info_config['pin_power'], False)
Exemplo n.º 4
0
def finalize(channels, info_config):
    """
    Do all operations necesary to shutdown.
    """

    # Stop recording.
    if channels:
        sensors.stop_channels(channels)

    # Turn off the sensors.
    if info_config:
        if info_config['pin_power']:
            print('pin_power off')
            dht22._digitalWrite(info_config['pin_power'], False)