# 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_dfrec', [dirname(__file__)])
except ImportError:
import _pyupm_dfrec
return _pyupm_dfrec
if fp is not None:
try:
_mod = imp.load_module('_pyupm_dfrec', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_dfrec = swig_import_helper()
del swig_import_helper
else:
import _pyupm_dfrec
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_dfrec.getVersion()
getVersion = _pyupm_dfrec.getVersion
def new_intp():
return _pyupm_dfrec.new_intp()
new_intp = _pyupm_dfrec.new_intp
def copy_intp(value):
return _pyupm_dfrec.copy_intp(value)
copy_intp = _pyupm_dfrec.copy_intp
def delete_intp(obj):
return _pyupm_dfrec.delete_intp(obj)
delete_intp = _pyupm_dfrec.delete_intp
def intp_assign(obj, value):
return _pyupm_dfrec.intp_assign(obj, value)
intp_assign = _pyupm_dfrec.intp_assign
def intp_value(obj):
return _pyupm_dfrec.intp_value(obj)
intp_value = _pyupm_dfrec.intp_value
def new_floatp():
return _pyupm_dfrec.new_floatp()
new_floatp = _pyupm_dfrec.new_floatp
def copy_floatp(value):
return _pyupm_dfrec.copy_floatp(value)
copy_floatp = _pyupm_dfrec.copy_floatp
def delete_floatp(obj):
return _pyupm_dfrec.delete_floatp(obj)
delete_floatp = _pyupm_dfrec.delete_floatp
def floatp_assign(obj, value):
return _pyupm_dfrec.floatp_assign(obj, value)
floatp_assign = _pyupm_dfrec.floatp_assign
def floatp_value(obj):
return _pyupm_dfrec.floatp_value(obj)
floatp_value = _pyupm_dfrec.floatp_value
[docs]class DFREC(_object):
"""
DFRobot EC Meter.
ID: dfrec
Name: Analog Electrical Conductivity (EC) Sensor
Category: liquid
Manufacturer: dfrobot
Connection: analog uart
Link:https://www.dfrobot.com/index.php?route=product/product&product_id=1123&search=DFR0300&description=true
#.Vx49p-_n-M8 The driver was tested with the DFRobot EC Analog
Sensor.
This device measure the electrical conductivity of an aqueous
solution. The included probe is a K=1 model.
Calibration is somewhat complicated - see the DFRobot wiki for
instructions on calibration. Functions are provided to supply the
appropriate values. By default, the values used in the DFRobot arduino
example are used.
wiki:https://www.dfrobot.com/wiki/index.php/Analog_EC_Meter_SKU:DFR0300
C++ includes: dfrec.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DFREC, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DFREC, name)
__repr__ = _swig_repr
def __init__(self, apin, uart_ow, device_idx, a_ref):
"""
DFREC(unsigned int apin,
unsigned int uart_ow, unsigned int device_idx, float a_ref)
DFREC object constructor
Parameters:
-----------
apin: Analog pin to use.
uart_ow: The UART that the ds10b20 temperature sensor is connected
to.
device_idx: The device index of the ds18b20 sensor to use. If you
only have 1 ds18b20 sensor on your DS one wire bus, you would pass 0
here.
a_ref: The analog reference voltage in use
dfrec context
"""
this = _pyupm_dfrec.new_DFREC(apin, uart_ow, device_idx, a_ref)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_dfrec.delete_DFREC
__del__ = lambda self: None
[docs] def update(self):
"""
void update()
Read the sensor status and update internal state. dfrec_update() must
have been called before calling any of the other get*() functions.
"""
return _pyupm_dfrec.DFREC_update(self)
[docs] def setOffset(self, offset):
"""
void setOffset(float
offset)
Set sensor offset. This offset is applied to the return EC value
before scaling. Default is 0.0.
Parameters:
-----------
offset: The offset to apply.
"""
return _pyupm_dfrec.DFREC_setOffset(self, offset)
[docs] def setScale(self, scale):
"""
void setScale(float
scale)
Set sensor scale. The return EC value is scaled by this value before
the offset is applied. Default is 1.0.
Parameters:
-----------
scale: The scale to apply.
"""
return _pyupm_dfrec.DFREC_setScale(self, scale)
[docs] def getEC(self):
"""
float getEC()
Get computed EC (ms/cm) value from the sensor. update() must have been
called prior to calling this function.
EC value in ms/cm.
"""
return _pyupm_dfrec.DFREC_getEC(self)
[docs] def getVolts(self):
"""
float getVolts()
Get the measured volts from the sensor. update() must have been called
prior to calling this function.
The voltage measurement.
"""
return _pyupm_dfrec.DFREC_getVolts(self)
[docs] def getNormalized(self):
"""
float
getNormalized()
Get the normalized ADC value from the sensor. update() must have been
called prior to calling this function.
The normalized ADC value.
"""
return _pyupm_dfrec.DFREC_getNormalized(self)
[docs] def getTemperature(self):
"""
float
getTemperature()
Get the measured temperature from the temperature sensor. The return
value will be in Celsius.
temperature read from the sensor in Celsius.
"""
return _pyupm_dfrec.DFREC_getTemperature(self)
[docs] def setThresholdMinMax(self, min, max):
"""
void
setThresholdMinMax(float min, float max)
Set the global threshold min and max values. See the DFRobot wiki for
details.
Parameters:
-----------
min: Minimum threshold to be valid. Default 150.
max: Maximum threshold to be valid. Default 3300.
"""
return _pyupm_dfrec.DFREC_setThresholdMinMax(self, min, max)
[docs] def setThreshold1(self, thres, scale, offset):
"""
void
setThreshold1(float thres, float scale, float offset)
Set the threshold 1 values. See the DFRobot wiki for details.
Parameters:
-----------
thres: Threshold maximum for value section 1. Default 448.
scale: Scale for value section 1. Default 6.64.
offset: Offset for value section 1. Default -64.32.
"""
return _pyupm_dfrec.DFREC_setThreshold1(self, thres, scale, offset)
[docs] def setThreshold2(self, thres, scale, offset):
"""
void
setThreshold2(float thres, float scale, float offset)
Set the threshold 2 values. See the DFRobot wiki for details.
Parameters:
-----------
thres: Threshold maximum for value section 2. Default 1457.
scale: Scale for value section 2. Default 6.98.
offset: Offset for value section 2. Default -127.0.
"""
return _pyupm_dfrec.DFREC_setThreshold2(self, thres, scale, offset)
[docs] def setThreshold3(self, scale, offset):
"""
void
setThreshold3(float scale, float offset)
Set the threshold 3 values. See the DFRobot wiki for details.
Parameters:
-----------
scale: Scale for value section 3. Default 5.3.
offset: Offset for value section 3. Default 2278.
"""
return _pyupm_dfrec.DFREC_setThreshold3(self, scale, offset)
DFREC_swigregister = _pyupm_dfrec.DFREC_swigregister
DFREC_swigregister(DFREC)
# This file is compatible with both classic and new-style classes.