You are viewing an older revision! See the latest version
MMA7660 Accelerometer
The MMA7660 is a 6-bit triple-axis accelerometer with +/- 1.5g range. Its a low power sensor mainly to be used for orientation detection of mobile devices and uses an I2C interface.
Hello World!¶
Import programMMA7660_HelloWorld
Hello World program for MMA7660
Library¶
Import library
Public Types |
|
| enum | Orientation |
|
The 6 different orientations and unknown. More... |
|
Public Member Functions |
|
| MMA7660 (PinName sda, PinName scl, bool active=true) | |
|
Creates a new
MMA7660
object.
|
|
| bool | testConnection (void) |
|
Tests if communication is possible with the
MMA7660
.
|
|
| void | setActive (bool state) |
|
Sets the active state of the
MMA7660
.
|
|
| void | readData (int *data) |
|
Reads acceleration data from the sensor.
|
|
| float | x (void) |
|
Get X-data.
|
|
| float | y (void) |
|
Get Y-data.
|
|
| float | z (void) |
|
Get Z-data.
|
|
| void | setSampleRate (int samplerate) |
|
Sets the active samplerate.
|
|
| Orientation | getSide (void) |
|
Returns if it is on its front, back, or unknown side.
|
|
| Orientation | getOrientation (void) |
|
Returns if it is on it left, right, down or up side.
|
|
