Source code for pyupm_otp538u

# 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_otp538u', [dirname(__file__)])
        except ImportError:
            import _pyupm_otp538u
            return _pyupm_otp538u
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_otp538u', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_otp538u = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_otp538u
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_otp538u.getVersion()
getVersion = _pyupm_otp538u.getVersion
[docs]class OTP538U(_object): """ API for the OTP538U IR Temperature Sensor. ID: otp538u Name: Analog IR Temperature Sensor Other Names: Grove IR Temperature Sensor Category: light Manufacturer: generic Connection: analog Link:http://wiki.seeed.cc/Grove-Infrared_Temperature_Sensor/ Kit: hak UPM module for the OTP538U IR temperature sensor This module was tested with the Grove IR non-contact temperature sensor. The sensor provides 2 analog outputs: one for the thermistor that measures the ambient temperature, and the other for the thermopile that measures the object temperature. Much of the code depends on analyzing Seeed Studio* examples and the circuit design. As a result, there are several 'magic' numbers derived from their circuit design. These values are used by default. The tables used came from the "538U VT Table__20_200(v1.3).pdf" and "538RT_table.pdf" datasheets. These tables assume the object to be measured is 9 cm (3.54 inches) from the sensor. This sensor will not work at 3.3v on the Edsion or the Galileo 2. It works fine on both systems at 5v. It will work at 3.3v on the Arduino 101 (tested via firmata subplatform on edison). C++ includes: otp538u.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, OTP538U, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, OTP538U, name) __repr__ = _swig_repr def __init__(self, pinA, pinO, aref=5.0): """ OTP538U(int pinA, int pinO, float aref=5.0) OTP538U constructor Parameters: ----------- pinA: Analog pin to use for the ambient temperature pinO: Analog pin to use for the object temperature aref: Analog reference voltage; default is 5.0 V """ this = _pyupm_otp538u.new_OTP538U(pinA, pinO, aref) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_otp538u.delete_OTP538U __del__ = lambda self: None
[docs] def ambientTemperature(self): """ float ambientTemperature() Gets the ambient temperature in Celsius Ambient temperature """ return _pyupm_otp538u.OTP538U_ambientTemperature(self)
[docs] def objectTemperature(self): """ float objectTemperature() Gets the object temperature in Celsius Object temperature """ return _pyupm_otp538u.OTP538U_objectTemperature(self)
[docs] def setVoltageOffset(self, vOffset): """ void setVoltageOffset(float vOffset) Sets the offset voltage The Seeed Studio wiki gives an example of calibrating the sensor and calculating the offset voltage to apply. Currently, the default value is set, but you can use the function to set one of your own. Parameters: ----------- vOffset: Desired offset voltage """ return _pyupm_otp538u.OTP538U_setVoltageOffset(self, vOffset)
[docs] def setOutputResistence(self, outResistance): """ void setOutputResistence(int outResistance) Sets the output resistance value The Seeed Studio wiki example uses a value of 2,000,000 in one of the equations used to calculate voltage. The value is the resistance of a resistor they use in the output stage of their SIG2 output. This was 'decoded' by looking at the EAGLE* files containing their schematics for this device. Parameters: ----------- outResistance: Value of the output resistor; default is 2M Ohm """ return _pyupm_otp538u.OTP538U_setOutputResistence(self, outResistance)
[docs] def setVRef(self, vref): """ void setVRef(float vref) Sets the reference voltage of the internal Seeed Studio voltage regulator on the sensor board. The Seeed Studio wiki example uses a value of 2.5 in one of the equations used to calculate the resistance of the ambient thermistor. The value is the voltage of an internal voltage regulator used on the sensor board. This was 'decoded' by looking at the EAGLE files containing their schematics for this device. Parameters: ----------- vref: Reference voltage of the internal sensor; default is 2.5 """ return _pyupm_otp538u.OTP538U_setVRef(self, vref)
[docs] def setDebug(self, enable): """ void setDebug(bool enable) Enable debugging output. Parameters: ----------- enable: true to enable some debug output, false otherwise """ return _pyupm_otp538u.OTP538U_setDebug(self, enable)
OTP538U_swigregister = _pyupm_otp538u.OTP538U_swigregister OTP538U_swigregister(OTP538U) # This file is compatible with both classic and new-style classes.