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.
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
Diff: quadCommand/sensors/sensors.cpp
- Revision:
- 43:e2fc699e8e8c
- Parent:
- 40:8c01bf294768
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/quadCommand/sensors/sensors.cpp Mon Jun 10 01:46:43 2013 +0000 @@ -0,0 +1,33 @@ +/************************ quadCommand.cpp ********************************/ +/* */ +/*************************************************************************/ +#include "sensors.h" + +/***************************** sensors() *********************************/ +/* */ +/*************************************************************************/ + +sensors::sensors() +{ + acc = new MMA8451Q( ACCSDA, ACCSCL, MMA8451_I2C_ADDRESS); +} + +/************************** getAbsoluteX() *******************************/ +/* Returns a float from -1 to 1 for the value off level in the x */ +/*directoin. 0 = level. */ +/*************************************************************************/ + +float sensors::getAbsoluteX() +{ + return acc->getAccX(); +} + +/************************** getAbsoluteY() *******************************/ +/* Returns a float from -1 to 1 for the value off level in the Y */ +/*directoin. 0 = level. */ +/*************************************************************************/ + +float sensors::getAbsoluteY() +{ + return acc->getAccY(); +}