Jim Carver
/
Hello_MMA8652
A Simple hello world for the MMA8652
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "MMA8652.h" 00003 00004 MMA8652 acc( A4, A5); 00005 Serial pc(USBTX, USBRX); 00006 00007 00008 int main() { 00009 float acc_data[3]; 00010 00011 printf("\r\n\nMMA8652 Who Am I= %X\r\n", acc.getWhoAmI()); 00012 while (true) { 00013 acc.ReadXYZ(acc_data); 00014 printf("MMA8652 ACC: X=%1.4f Y=%1.4f Z=%1.4f\r\n\n", acc_data[0], acc_data[1], acc_data[2]); 00015 wait(1.0); 00016 } 00017 }
Generated on Sat Jul 16 2022 07:52:22 by 1.7.2