FRDM Accelerometer Test
Dependencies: FRDM_MMA8451Q mbed
main.cpp
- Committer:
- schematic
- Date:
- 2013-11-13
- Revision:
- 0:dc9bb280dcd5
File content as of revision 0:dc9bb280dcd5:
#include "mbed.h" #include "MMA8451Q.h" #define MMA8451_I2C_ADDRESS (0x1d<<1) // --- Set Accelerometer MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); // --- Set Serial Port Serial pc(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx int main() { //float aX; //float aY; float aZ; //float z1; //float z2; //float diff; // --- Baud rate setting pc.baud(115200); wait(1); while(1) { //aX = acc.getAccX(); //aY = acc.getAccY(); aZ = acc.getAccZ(); //sprintf(str, "%+6.*f", 4, val); //printf("val = %s.\n", str); //printf("%f\n", floatVal); pc.printf("Z:%f<EOF>\r\n",aZ); //wait(0.02); } }