A simple hello world for the FXAS21000 gyro from Freescale

Dependencies:   FXAS21000 mbed

Committer:
JimCarver
Date:
Sat Apr 19 00:24:36 2014 +0000
Revision:
0:af0125b51903
Hello World for the FXAS21000

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JimCarver 0:af0125b51903 1 #include "mbed.h"
JimCarver 0:af0125b51903 2 #include "FXAS21000.h"
JimCarver 0:af0125b51903 3
JimCarver 0:af0125b51903 4 FXAS21000 gyro( A4, A5);
JimCarver 0:af0125b51903 5 Serial pc(USBTX, USBRX);
JimCarver 0:af0125b51903 6
JimCarver 0:af0125b51903 7
JimCarver 0:af0125b51903 8 int main() {
JimCarver 0:af0125b51903 9 float gyro_data[3];
JimCarver 0:af0125b51903 10
JimCarver 0:af0125b51903 11 printf("\r\n\nFXAS21000 Who Am I= %X\r\n", gyro.getWhoAmI());
JimCarver 0:af0125b51903 12 while (true) {
JimCarver 0:af0125b51903 13 gyro.ReadXYZ(gyro_data);
JimCarver 0:af0125b51903 14 printf("FXAS21000 X=%4.2f Y=%4.2f Z=%4.1f\r\n", gyro_data[0], gyro_data[1], gyro_data[2]);
JimCarver 0:af0125b51903 15 wait(1.0);
JimCarver 0:af0125b51903 16 }
JimCarver 0:af0125b51903 17 }