websocket client for gyro and 3-Axio Accelerometer

Dependencies:   ITG3200 MMA7660FC WebSocketClient WiflyInterface mbed

Revision:
2:edb0c7e84275
Parent:
1:f43651a4e987
Child:
3:b625c8d95e74
--- a/main.cpp	Thu Feb 05 03:28:32 2015 +0000
+++ b/main.cpp	Thu Feb 05 04:29:21 2015 +0000
@@ -33,7 +33,7 @@
  
    
     //gyro
-    int x = 0, y = 0, z = 0, temp = 0;
+    int gyro_x = 0, gyro_y = 0, gyro_z = 0, temp = 0;
     //Set highest bandwidth.
     gyro.setLpBandwidth(LPFBW_42HZ);
     //3Axio
@@ -44,9 +44,9 @@
         wait(0.1f);
         
         //gyro
-        x = gyro.getGyroX();
-        y = gyro.getGyroY();
-        z = gyro.getGyroZ();
+        gyro_x = gyro.getGyroX();
+        gyro_y = gyro.getGyroY();
+        gyro_z = gyro.getGyroZ();
         temp = gyro.getTemperature();
         
         //3-Axio
@@ -62,7 +62,7 @@
         
         
         //websocket send data
-        sprintf( data , "{ \"x\": %f, \"y\": %f, \"z\": %f\n , \"ax\": %f\n, \"ay\": %f\n, \"az\": %f\n}",  x, y, z ,ax,ay,az);
+        sprintf( data , "{ \"x\": %d, \"y\": %d, \"z\": %d , \"ax\": %f, \"ay\": %f, \"az\": %f\n}",  gyro_x, gyro_y, gyro_z ,ax,ay,az);
         ws.send(data);
         
         wait(1.0);