# 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_adxl335', [dirname(__file__)])
except ImportError:
import _pyupm_adxl335
return _pyupm_adxl335
if fp is not None:
try:
_mod = imp.load_module('_pyupm_adxl335', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_adxl335 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_adxl335
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_adxl335.getVersion()
getVersion = _pyupm_adxl335.getVersion
def new_intp():
return _pyupm_adxl335.new_intp()
new_intp = _pyupm_adxl335.new_intp
def copy_intp(value):
return _pyupm_adxl335.copy_intp(value)
copy_intp = _pyupm_adxl335.copy_intp
def delete_intp(obj):
return _pyupm_adxl335.delete_intp(obj)
delete_intp = _pyupm_adxl335.delete_intp
def intp_assign(obj, value):
return _pyupm_adxl335.intp_assign(obj, value)
intp_assign = _pyupm_adxl335.intp_assign
def intp_value(obj):
return _pyupm_adxl335.intp_value(obj)
intp_value = _pyupm_adxl335.intp_value
def new_floatp():
return _pyupm_adxl335.new_floatp()
new_floatp = _pyupm_adxl335.new_floatp
def copy_floatp(value):
return _pyupm_adxl335.copy_floatp(value)
copy_floatp = _pyupm_adxl335.copy_floatp
def delete_floatp(obj):
return _pyupm_adxl335.delete_floatp(obj)
delete_floatp = _pyupm_adxl335.delete_floatp
def floatp_assign(obj, value):
return _pyupm_adxl335.floatp_assign(obj, value)
floatp_assign = _pyupm_adxl335.floatp_assign
def floatp_value(obj):
return _pyupm_adxl335.floatp_value(obj)
floatp_value = _pyupm_adxl335.floatp_value
_pyupm_adxl335.ADXL335_DEFAULT_AREF_swigconstant(_pyupm_adxl335)
ADXL335_DEFAULT_AREF = _pyupm_adxl335.ADXL335_DEFAULT_AREF
_pyupm_adxl335.ADXL335_SENSITIVITY_swigconstant(_pyupm_adxl335)
ADXL335_SENSITIVITY = _pyupm_adxl335.ADXL335_SENSITIVITY
[docs]class ADXL335(_object):
"""
API for the ADXL335 3-Axis Analog Accelerometer.
ID: adxl335
Name: Low-power, 3-axis +/- 3 g Accelerometer
Other Names: Grove 3-Axis Analog Accelerometer
Category: accelerometer
Manufacturer: seeed
Connection: analog
Link:http://www.analog.com/en/products/mems/accelerometers/adxl335.html
UPM module for the ADXL335 3-axis analog accelerometer. This was
tested on a Grove 3-axis Analog Accelerometer. It uses 3 analog pins,
one for each axis: X, Y, and Z.
C++ includes: adxl335.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, ADXL335, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, ADXL335, name)
__repr__ = _swig_repr
def __init__(self, pinX, pinY, pinZ, aref=5.0):
"""
ADXL335(int pinX, int
pinY, int pinZ, float aref=ADXL335_DEFAULT_AREF)
ADXL335 constructor
Parameters:
-----------
pinX: Analog pin to use for X-axis
pinY: Analog pin to use for Y-axis
pinZ: Analog pin to use for Z-axis
aref: Analog reference voltage; default is 5.0v
"""
this = _pyupm_adxl335.new_ADXL335(pinX, pinY, pinZ, aref)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_adxl335.delete_ADXL335
__del__ = lambda self: None
[docs] def setZeroX(self, zeroX):
"""
void setZeroX(float
zeroX)
Sets the "zero" value of the X-axis, determined through calibration
Parameters:
-----------
zeroX: "Zero" value of the X-axis
"""
return _pyupm_adxl335.ADXL335_setZeroX(self, zeroX)
[docs] def setZeroY(self, zeroY):
"""
void setZeroY(float
zeroY)
Sets the "zero" value of the Y-axis, determined through calibration
Parameters:
-----------
zeroY: "Zero" value of the Y-axis
"""
return _pyupm_adxl335.ADXL335_setZeroY(self, zeroY)
[docs] def setZeroZ(self, zeroZ):
"""
void setZeroZ(float
zeroZ)
Sets the "zero" value of the Z-axis, determined through calibration
Parameters:
-----------
zeroZ: "Zero" value of the Z-axis
"""
return _pyupm_adxl335.ADXL335_setZeroZ(self, zeroZ)
[docs] def values(self, *args):
"""
std::vector< int >
values()
Gets the analog values for the 3 axes
std::vector of x, y, z analog acceleration values
"""
return _pyupm_adxl335.ADXL335_values(self, *args)
[docs] def acceleration(self, *args):
"""
std::vector< float
> acceleration()
Gets the acceleration along all 3 axes
std::vector of x, y, z acceleration values
"""
return _pyupm_adxl335.ADXL335_acceleration(self, *args)
[docs] def calibrate(self):
"""
void calibrate()
While the sensor is still, measures the X-axis, Y-axis, and Z-axis
values and uses those values as the zero values.
"""
return _pyupm_adxl335.ADXL335_calibrate(self)
ADXL335_swigregister = _pyupm_adxl335.ADXL335_swigregister
ADXL335_swigregister(ADXL335)
# This file is compatible with both classic and new-style classes.