![](/media/cache/profiles/Pass2.jpg.50x50_q85.jpg)
Reads the KL25Z accelerometer values and sends them to the serial port. RGB LED changes color accordingly.
Fork of FRDM_MMA8451Q by
main.cpp
- Committer:
- chris
- Date:
- 2012-10-12
- Revision:
- 3:f2d3e041d8f2
- Parent:
- 2:41db78380a6e
- Child:
- 4:367de1084ea9
File content as of revision 3:f2d3e041d8f2:
#include "mbed.h" #include "MMA8451Q.h" #define MMA8451_I2C_ADDRESS (0x1d<<1) MMA8451Q acc(P_E25, P_E24, MMA8451_I2C_ADDRESS); PwmOut rled(LED_RED); PwmOut gled(LED_GREEN); PwmOut bled(LED_BLUE); int main(void) { while (true) { rled = 1.0 - abs(acc.getAccX()); gled = 1.0 - abs(acc.getAccY()); bled = 1.0 - abs(acc.getAccZ()); wait(0.1); } }