Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
DimEngAcc3D Class Reference
Class to read acceleration measurements from Dimension Engineering Buffered +-3g Tri-axis Accelerometer device. More...
#include <DimEngAcc3D.h>
Public Member Functions | |
| DimEngAcc3D (PinName pin_x, PinName pin_y, PinName pin_z) | |
| Constructor. | |
| ~DimEngAcc3D (void) | |
| Destructor. | |
| void | setVoltage (float voltage) |
| Specify the supply voltage used by the device. | |
| void | read (void) |
| Read acceleration and store in x, y & z. | |
Data Fields | |
| float | x |
| Most recent acceleration in x axis (m/s/s). | |
| float | y |
| Most recent acceleration in y axis (m/s/s). | |
| float | z |
| Most recent acceleration in z axis (m/s/s). | |
Detailed Description
Class to read acceleration measurements from Dimension Engineering Buffered +-3g Tri-axis Accelerometer device.
Example
#include "mbed.h" #include "DimEngAcc3D.h " int main() { DimEngAcc3D *acc; // Create and configure object for 3.3V powered device, acc = new DimEngAcc3D(p18, p19, p20); acc->setVoltage(3.3); while(1) { // Read. acc->read(); // Print and delay 0.5s. printf("%.3f, %.3f, %.3f\r\n", acc->x, acc->y, acc->z); wait(0.5); } }
Definition at line 67 of file DimEngAcc3D.h.
Constructor & Destructor Documentation
| DimEngAcc3D | ( | PinName | pin_x, |
| PinName | pin_y, | ||
| PinName | pin_z | ||
| ) |
Constructor.
- Parameters:
-
pin_x Pin connected to output x of device. pin_y Pin connected to output y of device. pin_z Pin connected to output z of device.
- Note:
- Unused/unconnected outputs may be specified as NC.
Definition at line 31 of file DimEngAcc3D.cpp.
| ~DimEngAcc3D | ( | void | ) |
Destructor.
Definition at line 51 of file DimEngAcc3D.cpp.
Member Function Documentation
| void read | ( | void | ) |
Read acceleration and store in x, y & z.
Definition at line 88 of file DimEngAcc3D.cpp.
| void setVoltage | ( | float | voltage ) |
Specify the supply voltage used by the device.
- Parameters:
-
voltage The specified voltage (default 3.3)
- Note:
- This is important for correct conversion of the voltage from output pins of device into acceleration in m/s/s.
Definition at line 84 of file DimEngAcc3D.cpp.
Field Documentation
| float x |
Most recent acceleration in x axis (m/s/s).
Definition at line 85 of file DimEngAcc3D.h.
| float y |
Most recent acceleration in y axis (m/s/s).
Definition at line 86 of file DimEngAcc3D.h.
| float z |
Most recent acceleration in z axis (m/s/s).
Definition at line 87 of file DimEngAcc3D.h.
Generated on Sun Aug 21 2022 01:45:09 by
1.7.2