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:
19:40c252b4a792
Parent:
18:c8c09a3913ba
Child:
20:e116e596e540
--- a/Sensors/Acc/ADXL345.cpp	Sat Nov 03 07:44:07 2012 +0000
+++ b/Sensors/Acc/ADXL345.cpp	Sat Nov 03 10:48:18 2012 +0000
@@ -25,9 +25,9 @@
     
     readMultiRegister(ADXL345_DATAX0_REG, buffer, 6);   // read axis registers using I2C
     
-    data[0] = (short) (buffer[1] << 8 | buffer[0]);     // join 8-Bit pieces to 16-bit short integers
-    data[1] = (short) (buffer[3] << 8 | buffer[2]);
-    data[2] = (short) (buffer[5] << 8 | buffer[4]);
+    data[0] = (float)(short) (buffer[1] << 8 | buffer[0]);     // join 8-Bit pieces to 16-bit short integers
+    data[1] = (float)(short) (buffer[3] << 8 | buffer[2]);
+    data[2] = (float)(short) (buffer[5] << 8 | buffer[4]);
     
     // calculate the angles for roll and pitch (0,1)
     float R = sqrt(pow((float)data[0],2) + pow((float)data[1],2) + pow((float)data[2],2));  // calculate the absolute of the magnetic field vector