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.
Fork of MMA8451Q by
MMA8451Q Class Reference
MMA8451Q accelerometer example, 8-bit samples. More...
#include <MMA8451Q.h>
Public Member Functions | |
| MMA8451Q (PinName sda, PinName scl) | |
| MMA8451Q constructor. | |
| ~MMA8451Q () | |
| MMA8451Q destructor. | |
| void | getAccAllAxis (int16_t *res) |
| Get XYZ axis acceleration, 8-bits. | |
Detailed Description
MMA8451Q accelerometer example, 8-bit samples.
#include "mbed.h" #include "MMA8451Q.h" int main(void) { MMA8451Q acc(PTE25, PTE24); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); uint8_t data[3]; while (true) { acc.getAccAllAxis(data); rled = 1.0 - abs(data[0]/128); gled = 1.0 - abs(data[0]/128); bled = 1.0 - abs(data[0]/128); wait(0.4); } }
Definition at line 50 of file MMA8451Q.h.
Constructor & Destructor Documentation
| MMA8451Q | ( | PinName | sda, |
| PinName | scl | ||
| ) |
| ~MMA8451Q | ( | ) |
MMA8451Q destructor.
Definition at line 58 of file MMA8451Q.cpp.
Member Function Documentation
| void getAccAllAxis | ( | int16_t * | res ) |
Get XYZ axis acceleration, 8-bits.
- Parameters:
-
res array where acceleration data will be stored
Definition at line 60 of file MMA8451Q.cpp.
Generated on Sat Jul 16 2022 00:36:29 by
1.7.2
