A simple hello world for the FXAS21000 gyro from Freescale

Dependencies:   FXAS21000 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "FXAS21000.h"
00003 
00004 FXAS21000 gyro( A4, A5);
00005 Serial pc(USBTX, USBRX);
00006 
00007 
00008 int main() {
00009 float gyro_data[3];
00010 
00011 printf("\r\n\nFXAS21000 Who Am I= %X\r\n", gyro.getWhoAmI());
00012     while (true) {
00013         gyro.ReadXYZ(gyro_data);
00014         printf("FXAS21000      X=%4.2f Y=%4.2f Z=%4.1f\r\n", gyro_data[0], gyro_data[1], gyro_data[2]);
00015         wait(1.0);
00016     }
00017 }