#include <Accelerometer.h>
Public Member Functions | |
Accelerometer (unsigned channel) | |
Accelerometer (unsigned slot, unsigned channel) | |
Accelerometer (AnalogChannel *channel) | |
~Accelerometer (void) | |
float | GetAcceleration (void) |
void | SetSensitivity (float sensitivity) |
void | SetZero (float zero) |
Accelerometer::Accelerometer | ( | unsigned | channel | ) |
Create a new instance of an accelerometer.
The accelerometer is assumed to be in the first analog module in the given analog channel. The constructor allocates desired analog channel.
Accelerometer::Accelerometer | ( | unsigned | slot, | |
unsigned | channel | |||
) |
Create new instance of accelerometer.
Make a new instance of the accelerometer given a module and channel. The constructor allocates the desired analog channel from the specified module
Accelerometer::Accelerometer | ( | AnalogChannel * | channel | ) |
Create a new instance of Accelerometer from an existing AnalogChannel. Make a new instance of accelerometer given an AnalogChannel. This is particularly useful if the port is going to be read as an analog channel as well as through the Accelerometer class.
Accelerometer::~Accelerometer | ( | void | ) |
Delete the analog components used for the accelerometer.
float Accelerometer::GetAcceleration | ( | void | ) |
Return the acceleration in Gs.
The acceleration is returned units of Gs.
void Accelerometer::SetSensitivity | ( | float | sensitivity | ) |
Set the accelerometer sensitivity.
This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varys by accelerometer model. There are constants defined for various models.
sensitivity | The sensitivity of accelerometer in Volts per G. |
void Accelerometer::SetZero | ( | float | zero | ) |
Set the voltage that corresponds to 0 G.
The zero G voltage varys by accelerometer model. There are constants defined for various models.
zero | The zero G voltage. |