TAMU IEEE
/
FRDM_MMA8451Q
Demo for Accel
Fork of FRDM_MMA8451Q by
main.cpp
- Committer:
- chris
- Date:
- 2012-10-12
- Revision:
- 2:41db78380a6e
- Parent:
- 0:d9c1551e1fdc
- Child:
- 3:f2d3e041d8f2
File content as of revision 2:41db78380a6e:
#include "mbed.h" #include "MMA8451Q.h" #define MMA8451_I2C_ADDRESS (0x1d<<1) int main(void) { DigitalOut led(LED_GREEN); MMA8451Q acc(P_E25, P_E24, MMA8451_I2C_ADDRESS); printf("WHO AM I: 0x%2X\r\n", acc.getWhoAmI()); while (true) { printf("-----------\r\n"); printf("acc_x: %.3f\r\n", acc.getAccX()); printf("acc_y: %.3f\r\n", acc.getAccY()); printf("acc_z: %.3f\r\n", acc.getAccZ()); wait(1); led = !led; } }