# 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_dfrorp', [dirname(__file__)])
except ImportError:
import _pyupm_dfrorp
return _pyupm_dfrorp
if fp is not None:
try:
_mod = imp.load_module('_pyupm_dfrorp', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_dfrorp = swig_import_helper()
del swig_import_helper
else:
import _pyupm_dfrorp
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_dfrorp.getVersion()
getVersion = _pyupm_dfrorp.getVersion
def new_intp():
return _pyupm_dfrorp.new_intp()
new_intp = _pyupm_dfrorp.new_intp
def copy_intp(value):
return _pyupm_dfrorp.copy_intp(value)
copy_intp = _pyupm_dfrorp.copy_intp
def delete_intp(obj):
return _pyupm_dfrorp.delete_intp(obj)
delete_intp = _pyupm_dfrorp.delete_intp
def intp_assign(obj, value):
return _pyupm_dfrorp.intp_assign(obj, value)
intp_assign = _pyupm_dfrorp.intp_assign
def intp_value(obj):
return _pyupm_dfrorp.intp_value(obj)
intp_value = _pyupm_dfrorp.intp_value
def new_floatp():
return _pyupm_dfrorp.new_floatp()
new_floatp = _pyupm_dfrorp.new_floatp
def copy_floatp(value):
return _pyupm_dfrorp.copy_floatp(value)
copy_floatp = _pyupm_dfrorp.copy_floatp
def delete_floatp(obj):
return _pyupm_dfrorp.delete_floatp(obj)
delete_floatp = _pyupm_dfrorp.delete_floatp
def floatp_assign(obj, value):
return _pyupm_dfrorp.floatp_assign(obj, value)
floatp_assign = _pyupm_dfrorp.floatp_assign
def floatp_value(obj):
return _pyupm_dfrorp.floatp_value(obj)
floatp_value = _pyupm_dfrorp.floatp_value
[docs]class DFRORP(_object):
"""
API for the DFRobot ORP (Oxidation/Reduction Potential) Sensor.
ID: dfrorp
Name: Analog Oxidation Reduction Potential (ORP) Sensor
Category: liquid
Manufacturer: dfrobot
Connection: ainput
Link:http://www.dfrobot.com/index.php?route=product/product&path=36&product_id=1071#.V8Wywt9ytNJ
This library was tested with the DFRobot ORP (Oxidation/Reduction
Potential) Sensor.
To calibrate:
Disconnect the sensor probe (but leave the sensor interface board
connected). Then run one of the examples while holding down the
'calibrate' button on the device. Read the ORP value reported (it
should be fairly small).
This value is what you should supply to setCalibrationOffset(). Then
reconnect the probe to the interface board and you should be ready to
go.
DO NOT press the calibrate button on the interface board while the
probe is attached or you can permanently damage the probe.
C++ includes: dfrorp.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, DFRORP, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, DFRORP, name)
__repr__ = _swig_repr
def __init__(self, apin, a_ref=5.0):
"""
DFRORP(int apin, float
a_ref=5.0)
DFRORP object constructor
Parameters:
-----------
apin: Analog pin to use
a_ref: The analog reference voltage in use. Default 5.0.
"""
this = _pyupm_dfrorp.new_DFRORP(apin, a_ref)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_dfrorp.delete_DFRORP
__del__ = lambda self: None
[docs] def update(self):
"""
void update()
Read the sensor status an update internal state. update() must have
been called before calling getORP(), getNormalized(), or getVolts().
"""
return _pyupm_dfrorp.DFRORP_update(self)
[docs] def setOffset(self, offset):
"""
void setOffset(float
offset)
Set sensor offset. This offset is applied to the return ORP value
before scaling. Default is 0.0.
Parameters:
-----------
offset: The offset to apply.
"""
return _pyupm_dfrorp.DFRORP_setOffset(self, offset)
[docs] def setScale(self, scale):
"""
void setScale(float
scale)
Set sensor scale. The return ORP value is scaled by this value before
the offset is applied. Default is 1.0.
Parameters:
-----------
scale: The scale to apply.
"""
return _pyupm_dfrorp.DFRORP_setScale(self, scale)
[docs] def getORP(self):
"""
float getORP()
Get computed ORP (in millivolts) value from the sensor. update() must
have been called prior to calling this function.
ORP value in millivolts
"""
return _pyupm_dfrorp.DFRORP_getORP(self)
[docs] def setCalibrationOffset(self, offset):
"""
void
setCalibrationOffset(float offset)
Set the calibration offset for the device. This is determined by
disconnecting the sensor probe (but leaving the sensor interface board
connected). Then run one of the examples while holding down the
'calibrate' button on the device. Read the ORP value reported.
This (low) ORP value is what you should supply to this function. Then
reconnect the probe to the interface board and you should be ready to
go.
DO NOT press the calibrate button on the interface board while the
probe is attached or you can permanently damage the probe.
Parameters:
-----------
offset: The ORP offset obtained during calibration.
"""
return _pyupm_dfrorp.DFRORP_setCalibrationOffset(self, offset)
[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_dfrorp.DFRORP_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_dfrorp.DFRORP_getNormalized(self)
DFRORP_swigregister = _pyupm_dfrorp.DFRORP_swigregister
DFRORP_swigregister(DFRORP)
# This file is compatible with both classic and new-style classes.