adsfawre

Dependencies:   MMA7660 mbed

Fork of MMA7660_HelloWorld by Erik -

Files at this revision

API Documentation at this revision

Comitter:
ogris
Date:
Wed Apr 05 08:54:40 2017 +0000
Parent:
2:0af77f74afb2
Commit message:
sadfawer

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue May 13 18:15:06 2014 +0000
+++ b/main.cpp	Wed Apr 05 08:54:40 2017 +0000
@@ -4,18 +4,29 @@
 #include "MMA7660.h"
 
 MMA7660 MMA(p28, p27);
+Serial pc(USBTX,USBRX);
+
 
 DigitalOut connectionLed(LED1);
-PwmOut Zaxis_p(LED2);
-PwmOut Zaxis_n(LED3);
 
 int main() {  
-    if (MMA.testConnection())
-        connectionLed = 1;
+float x=0,y=0,z=0;
+    pc.baud(115200);
+    if (MMA.testConnection()){
+                connectionLed = 1;
+               pc.printf("connected \n");
+        }
+        
         
     while(1) {
-        Zaxis_p = MMA.z();
-        Zaxis_n = -MMA.z();
+        x += MMA.x();
+        y += MMA.y();
+        z += MMA.z();
+        x = x/2;
+        y = y/2;
+        z = z/2;
+        pc.printf(":%lf;%lf;%lf\n",x,y,z);
+        wait_ms(100);
     }
 
 }