Jim Carver
/
Hello_FXAS21000
A simple hello world for the FXAS21000 gyro from Freescale
Diff: main.cpp
- Revision:
- 0:af0125b51903
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Apr 19 00:24:36 2014 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "FXAS21000.h" + +FXAS21000 gyro( A4, A5); +Serial pc(USBTX, USBRX); + + +int main() { +float gyro_data[3]; + +printf("\r\n\nFXAS21000 Who Am I= %X\r\n", gyro.getWhoAmI()); + while (true) { + gyro.ReadXYZ(gyro_data); + printf("FXAS21000 X=%4.2f Y=%4.2f Z=%4.1f\r\n", gyro_data[0], gyro_data[1], gyro_data[2]); + wait(1.0); + } +} \ No newline at end of file