A simple hello world for the FXLS8471Q using SPI mode

Dependencies:   FXLS8471Q mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "FXLS8471Q.h"
00003 
00004 FXLS8471Q acc(D11, D12, D13, D10);
00005 Serial pc(USBTX, USBRX);
00006 
00007 
00008 int main() {
00009 float acc_data[3];
00010 
00011 printf("\r\n\nFXLS8471Q Who Am I= %X\r\n", acc.getWhoAmI());
00012     while (true) {
00013         acc.ReadXYZ(acc_data);
00014         printf("FXLS8471Q      X=%1.4f Y=%1.4f Z=%1.4f\r\n", acc_data[0], acc_data[1], acc_data[2]);
00015         wait(1.0);
00016     }
00017 }