this is sample source of MMA8452

Dependencies:   mbed

Fork of MMA8452 by Hiroaki Matsuda

Files at this revision

API Documentation at this revision

Comitter:
matsu
Date:
Wed Nov 28 17:05:31 2012 +0000
Parent:
0:904e837fccc5
Commit message:
ver1:get analog data from MMA8452

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 904e837fccc5 -r 0c1dd02be97a main.cpp
--- a/main.cpp	Wed Nov 28 16:55:32 2012 +0000
+++ b/main.cpp	Wed Nov 28 17:05:31 2012 +0000
@@ -33,7 +33,6 @@
         wait(0.07);
         switch(number){
         case 0:
-//            i2c.start();
             if(i2c.write(0x3A,add,1) == 0){
                 number++;
                 led1 = 1;
@@ -45,7 +44,6 @@
             }
             break;
         case 1:
-//            i2c.start();
             if(i2c.read(0x3A,cmd,6) == 0){
                 number++;
                 led2 = 1;
@@ -57,7 +55,7 @@
             }
             break;    
         case 2:
-//            pc.printf("\r cmd1 = %d,cmd2 = %d,cmd3 = %d                ",((cmd[0]<<4)+(cmd[1]>>4)),((cmd[2]<<4)+(cmd[3]>>4)),((cmd[4]<<4)+(cmd[5]>>4)));
+            //get analog data
             pc.printf("\r X = %d,Y = %d,Z = %d                ",cmd[1],cmd[3],cmd[5]);
             led3 = 1;
             wait(0.5);