upm
0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
|
API for the ADXL335 3-Axis Analog Accelerometer. More...
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.
Public Member Functions | |
ADXL335 (int pinX, int pinY, int pinZ, float aref=ADXL335_DEFAULT_AREF) | |
~ADXL335 () | |
void | setZeroX (float zeroX) |
void | setZeroY (float zeroY) |
void | setZeroZ (float zeroZ) |
void | values (int *xVal, int *yVal, int *zVal) |
void | acceleration (float *xAccel, float *yAccel, float *zAccel) |
void | calibrate () |
ADXL335 | ( | int | pinX, |
int | pinY, | ||
int | pinZ, | ||
float | aref = ADXL335_DEFAULT_AREF |
||
) |
ADXL335 constructor
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 |
|
inline |
Sets the "zero" value of the X-axis, determined through calibration
zeroX | "Zero" value of the X-axis |
|
inline |
Sets the "zero" value of the Y-axis, determined through calibration
zeroY | "Zero" value of the Y-axis |
|
inline |
Sets the "zero" value of the Z-axis, determined through calibration
zeroZ | "Zero" value of the Z-axis |
void values | ( | int * | xVal, |
int * | yVal, | ||
int * | zVal | ||
) |
Gets the analog values for the 3 axes
xVal | Pointer to the returned X-axis value |
yVal | Pointer to the returned Y-axis value |
zVal | Pointer to the returned Z-axis value |
void acceleration | ( | float * | xAccel, |
float * | yAccel, | ||
float * | zAccel | ||
) |
Gets the acceleration along all 3 axes
xAccel | Pointer to returned X-axis value |
yAccel | Pointer to returned Y-axis value |
zAccel | Pointer to returned Z-axis value |
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.