Source code for pyupm_cwlsxxa

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.





from sys import version_info
if version_info >= (2, 6, 0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_pyupm_cwlsxxa', [dirname(__file__)])
        except ImportError:
            import _pyupm_cwlsxxa
            return _pyupm_cwlsxxa
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_cwlsxxa', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_cwlsxxa = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_cwlsxxa
del version_info
try:
    _swig_property = property
except NameError:
    pass  # Python < 2.2 doesn't have 'property'.


def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
    if (name == "thisown"):
        return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name, None)
    if method:
        return method(self, value)
    if (not static):
        if _newclass:
            object.__setattr__(self, name, value)
        else:
            self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)


def _swig_setattr(self, class_type, name, value):
    return _swig_setattr_nondynamic(self, class_type, name, value, 0)


def _swig_getattr_nondynamic(self, class_type, name, static=1):
    if (name == "thisown"):
        return self.this.own()
    method = class_type.__swig_getmethods__.get(name, None)
    if method:
        return method(self)
    if (not static):
        return object.__getattr__(self, name)
    else:
        raise AttributeError(name)

def _swig_getattr(self, class_type, name):
    return _swig_getattr_nondynamic(self, class_type, name, 0)


def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object:
        pass
    _newclass = 0



def getVersion():
    return _pyupm_cwlsxxa.getVersion()
getVersion = _pyupm_cwlsxxa.getVersion

_pyupm_cwlsxxa.CWLSXXA_DEFAULT_AREF_swigconstant(_pyupm_cwlsxxa)
CWLSXXA_DEFAULT_AREF = _pyupm_cwlsxxa.CWLSXXA_DEFAULT_AREF
[docs]class CWLSXXA(_object): """ API for the Veris CWLSXXA CO2 Sensor Family. ID: cwlsxxa Name: CO2/temperature/humidity Transmitter Category: temp gaseous Manufacturer: veris Connection: analog Link:http://www.veris.com/Item/CWLSHTA.aspx The driver was developed using the CWLSHTA CO2 Gas sensor. The 'T' variant supports a temperature transmitter, and the 'H' variant supports a humidity sensor. All 3 signals are provided by the device as analog 0-5Vdc, 0-10Vdc, or 4-20ma loop current outputs. For devices supporting temperature, the valid temperature range is 10C to 50C. The humidity ranges from 0% to 100% (non-condensing). The CO2 sensor ranges from 0 to 2000 ppm. This driver was developed using the 5Vdc outputs and the 4-20ma outputs. For voltage outputs, your MCU must be configured for 5V operation. In addition, you must configure the sensor (via it's configuration switches) to output 0-5VDC only. Using any other analog reference voltage will require the appropriate external circuitry (such as a voltage divider) in order to interface safely with your MCU. In addition, the sensor can be configured for 4-20ma usage, by specifying the correct receiver resistance (in ohms) in the constructor. This sensor was tested with a Cooking Hacks (Libelium) 4-channel 4-20ma Arduino interface shield. For this interface, the receiver resistance was specified as 165.0 ohms. For devices which do not support temperature, use '-1' as the temperature pin number in the object constructor. If temperature measurement is disabled, getTemperature() will always return 0C/32F. For devices which do not support humidity, use '-1' as the temperature pin number in the object constructor. If humidity measurement is disabled, getHumidity() will always return 0. C++ includes: cwlsxxa.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, CWLSXXA, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, CWLSXXA, name) __repr__ = _swig_repr def __init__(self, gPin, hPin, tPin, rResistor=0.0, aref=5.0): """ CWLSXXA(int gPin, int hPin, int tPin, float rResistor=0.0, float aref=CWLSXXA_DEFAULT_AREF) CWLSXXA object constructor Parameters: ----------- gPin: Analog pin to use for the CO2 measurement hPin: Analog pin to use for the humidity measurement. If your device does not support humidity, use -1 as the value so that humidity will not be queried and an analog pin won't be wasted. tPin: Analog pin to use for temperature. If your device does not support temperature, use -1 as the value so that temperature will not be queried and an analog pin won't be wasted. rResistor: The receiver resistance in ohms, when using a 4-20ma current loop interface. When specified, this value will be used in computing the current based on the voltage read when scaling the return values. Default is 0.0, for standard scaling based on voltage output rather than current (4-20ma mode). aref: The analog reference voltage, default 5.0 """ this = _pyupm_cwlsxxa.new_CWLSXXA(gPin, hPin, tPin, rResistor, aref) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_cwlsxxa.delete_CWLSXXA __del__ = lambda self: None
[docs] def update(self): """ void update() Read current values from the sensor and update internal stored values. This method must be called prior to querying any values, such as CO2, temperature, or humidity. """ return _pyupm_cwlsxxa.CWLSXXA_update(self)
[docs] def getTemperature(self, fahrenheit=False): """ float getTemperature(bool fahrenheit=false) Get the current temperature. update() must have been called prior to calling this method. If temperature measurement was disabled (by passing -1 as the temperature pin in the constructor) then this function will always return 0C/32F. Parameters: ----------- fahrenheit: true to return the temperature in degrees fahrenheit, false to return the temperature in degrees celsius. The default is false (degrees Celsius). The last temperature reading in Celsius or Fahrenheit """ return _pyupm_cwlsxxa.CWLSXXA_getTemperature(self, fahrenheit)
[docs] def getHumidity(self): """ float getHumidity() Get the current relative humidity. update() must have been called prior to calling this method. If humidity measurement was disabled (by passing -1 as the te pin in the constructor) then this function will always return 0. The last humidity reading """ return _pyupm_cwlsxxa.CWLSXXA_getHumidity(self)
[docs] def getCO2(self): """ float getCO2() Get the current CO2 concentration in Parts Per Million (PPM). update() must have been called prior to calling this method. The last CO2 reading """ return _pyupm_cwlsxxa.CWLSXXA_getCO2(self)
CWLSXXA_swigregister = _pyupm_cwlsxxa.CWLSXXA_swigregister CWLSXXA_swigregister(CWLSXXA) # This file is compatible with both classic and new-style classes.