NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.

Dependencies:   mbed MODI2C

Revision:
10:953afcbcebfc
Parent:
2:93f703d2c4d7
Child:
11:9bf69bc6df45
--- a/Sensors/Gyro/L3G4200D.cpp	Tue Oct 16 10:21:32 2012 +0000
+++ b/Sensors/Gyro/L3G4200D.cpp	Wed Oct 17 08:37:08 2012 +0000
@@ -38,12 +38,11 @@
             offset[j] = 0;
             
     float Gyro_calib[3] = {0,0,0}; // temporary to sum up
-    float Gyro_data[3];
     
     for (int i = 0; i < count; i++) {
-        read(Gyro_data);
+        read();
         for (int j = 0; j < 3; j++)
-            Gyro_calib[j] += Gyro_data[j];
+            Gyro_calib[j] += data[j];
         wait(0.001); // maybe less or no wait !!
     }
     
@@ -73,7 +72,7 @@
 }
 
 // Reads the 3 gyro channels and stores them in vector g
-void L3G4200D::read(float g[3])
+void L3G4200D::read()
 {
     byte buffer[6]; // 8-Bit pieces of axis data
     // assert the MSB of the address to get the gyro 
@@ -93,13 +92,13 @@
     uint8_t zla = buffer[4];
     uint8_t zha = buffer[5];
 
-    g[0] = (short) (xha << 8 | xla);
-    g[1] = (short) (yha << 8 | yla);
-    g[2] = (short) (zha << 8 | zla);
+    data[0] = (short) (xha << 8 | xla);
+    data[1] = (short) (yha << 8 | yla);
+    data[2] = (short) (zha << 8 | zla);
     
     //with offset of calibration
     for (int j = 0; j < 3; j++)
-            g[j] -= offset[j];
+            data[j] -= offset[j];
 }
 
 // Reads the gyros Temperature