|
upm
0.3.1
Sensor/Actuator repository for libmraa (v0.7.2)
|
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 each for X, Y, and Z axis.
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 axis X |
| pinY | analog pin to use for axis Y |
| pinZ | analog pin to use for axis Z |
| aref | analog voltage reference, default 5.0 |
|
inline |
Set the "zero" value of the X axis, determined through calibration
| zeroX | The "zero" value of the X axis |
|
inline |
Set the "zero" value of the Y axis, determined through calibration
| zeroX | The "zero" value of the Y axis |
|
inline |
Set the "zero" value of the Z axis, determined through calibration
| zeroX | The "zero" value of the Z axis |
| void values | ( | int * | xVal, |
| int * | yVal, | ||
| int * | zVal | ||
| ) |
Get the analog values for the 3 axes
| xVal | pointer to returned X value |
| yVal | pointer to returned Y value |
| zVal | pointer to returned Z value |
| void acceleration | ( | float * | xAccel, |
| float * | yAccel, | ||
| float * | zAccel | ||
| ) |
Get the acceleration along all 3 axes
| xAccel | pointer to returned X value |
| yAccel | pointer to returned Y value |
| zAccel | pointer to returned Z value |
| void calibrate | ( | ) |
While the sensor is still, measure the X, Y, and Z values and use those values as our zero values.
1.8.9.1