MSS / Mbed 2 deprecated test_MMA8451Q

Dependencies:   MMA8451Q mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "MMA8451Q.h"
00003 #include "MSS.h"
00004 
00005 MMA8451Q *acc = 0 ;
00006 
00007 int main() {
00008     float fx, fy, fz ;
00009 
00010 #if 0 // for  FRDM-KL25Z ONBOARDSENSOR
00011     acc = new MMA8451Q(PTE25, PTE24, 0x1D) ;
00012 #endif
00013 #if 1 // for MSU MMA8451Q on MSS
00014     acc = new MMA8451Q(PIN_SDA, PIN_SCL, 0x1C) ; 
00015 #endif 
00016 
00017     printf("=== test MMA8451Q for %s (%s) ===\n", BOARD_NAME, __DATE__) ;
00018     printf("    X,    Y,   Z\n") ;
00019  
00020     while(1) {
00021         fx = acc->getAccX() ;
00022         fy = acc->getAccY() ;
00023         fz = acc->getAccZ() ;
00024         printf("%.2f, %.2f, %.2f\n", fx, fy, fz ) ;
00025         wait(0.2) ;
00026     }
00027 }