Example program for FRDM boards with a Freescale MMA8451Q accelerometer
Fork of FRDM_MMA8451Q by
main.cpp
- Committer:
- mbed_official
- Date:
- 2013-02-19
- Revision:
- 7:70775be9f474
- Parent:
- 5:bf5becf7469c
- Child:
- 8:d797bfa9f76e
File content as of revision 7:70775be9f474:
#include "mbed.h" #include "MMA8451Q.h" #define MMA8451_I2C_ADDRESS (0x1d<<1) int main(void) { MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); while (true) { rled = 1.0 - abs(acc.getAccX()); gled = 1.0 - abs(acc.getAccY()); bled = 1.0 - abs(acc.getAccZ()); wait(0.1); } }