A simple hello world for the FXAS21000 gyro from Freescale

Dependencies:   FXAS21000 mbed

main.cpp

Committer:
JimCarver
Date:
2014-04-19
Revision:
0:af0125b51903

File content as of revision 0:af0125b51903:

#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);
    }
}