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
quadCommand/sensorS/sensors.cpp@40:8c01bf294768, 2013-06-10 (annotated)
- Committer:
- gabdo
- Date:
- Mon Jun 10 01:32:09 2013 +0000
- Revision:
- 40:8c01bf294768
- Parent:
- 37:8114f9c7c40b
Minor updates
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gabdo | 0:8681037b9a18 | 1 | /************************ quadCommand.cpp ********************************/ |
gabdo | 0:8681037b9a18 | 2 | /* */ |
gabdo | 0:8681037b9a18 | 3 | /*************************************************************************/ |
gabdo | 0:8681037b9a18 | 4 | #include "sensors.h" |
gabdo | 0:8681037b9a18 | 5 | |
gabdo | 9:9e0d0ba5b6b1 | 6 | /***************************** sensors() *********************************/ |
gabdo | 9:9e0d0ba5b6b1 | 7 | /* */ |
gabdo | 9:9e0d0ba5b6b1 | 8 | /*************************************************************************/ |
gabdo | 9:9e0d0ba5b6b1 | 9 | |
gabdo | 0:8681037b9a18 | 10 | sensors::sensors() |
gabdo | 0:8681037b9a18 | 11 | { |
gabdo | 36:342213315dce | 12 | acc = new MMA8451Q( ACCSDA, ACCSCL, MMA8451_I2C_ADDRESS); |
gabdo | 0:8681037b9a18 | 13 | } |
gabdo | 0:8681037b9a18 | 14 | |
gabdo | 9:9e0d0ba5b6b1 | 15 | /************************** getAbsoluteX() *******************************/ |
gabdo | 9:9e0d0ba5b6b1 | 16 | /* Returns a float from -1 to 1 for the value off level in the x */ |
gabdo | 9:9e0d0ba5b6b1 | 17 | /*directoin. 0 = level. */ |
gabdo | 9:9e0d0ba5b6b1 | 18 | /*************************************************************************/ |
gabdo | 9:9e0d0ba5b6b1 | 19 | |
gabdo | 4:ce6ad16337c5 | 20 | float sensors::getAbsoluteX() |
gabdo | 0:8681037b9a18 | 21 | { |
gabdo | 9:9e0d0ba5b6b1 | 22 | return acc->getAccX(); |
gabdo | 0:8681037b9a18 | 23 | } |
gabdo | 0:8681037b9a18 | 24 | |
gabdo | 9:9e0d0ba5b6b1 | 25 | /************************** getAbsoluteY() *******************************/ |
gabdo | 9:9e0d0ba5b6b1 | 26 | /* Returns a float from -1 to 1 for the value off level in the Y */ |
gabdo | 9:9e0d0ba5b6b1 | 27 | /*directoin. 0 = level. */ |
gabdo | 9:9e0d0ba5b6b1 | 28 | /*************************************************************************/ |
gabdo | 9:9e0d0ba5b6b1 | 29 | |
gabdo | 4:ce6ad16337c5 | 30 | float sensors::getAbsoluteY() |
gabdo | 0:8681037b9a18 | 31 | { |
gabdo | 9:9e0d0ba5b6b1 | 32 | return acc->getAccY(); |
gabdo | 11:a80e854955dc | 33 | } |