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:
1:5a64632b1eb9
Parent:
0:0c4fafa398b4
Child:
2:93f703d2c4d7
--- a/main.cpp	Wed Sep 26 12:15:00 2012 +0000
+++ b/main.cpp	Fri Sep 28 13:24:03 2012 +0000
@@ -1,48 +1,43 @@
-#include "mbed.h"
+#include "mbed.h" // Standar Library
 #include "LCD.h" // Display
 #include "LED.h" // LEDs
 #include "L3G4200D.h" // Gyro
 #include "ADXL345.h" // Acc
+#include "Servo.h" // Motor
 
-PinName kl[4] = {LED1, LED2, LED3, LED4};
-LED Led();
+// initialisation
+LED LEDs;
 TextLCD LCD(p5, p6, p7, p8, p9, p10, p11, TextLCD::LCD16x2); // RS, RW, E, D0, D1, D2, D3, Typ
-
-// Sensor initialisation
-Gyro Gyro(p28, p27);
+L3G4200D Gyro(p28, p27);
 ADXL345 Acc(p28, p27);
+Servo Motor(p12);
 
 int main() {
-
+    // LCD/LED init
+    LCD.cls(); // Display löschen
     LCD.printf("FlyBed v0.1");
+    LEDs.roll(2);
+    //LEDs = 15;
     
-    wait(2);
-    int j = -1;
     int Gyro_data[3];
     int Acc_data[3];
     
-    Acc.setPowerControl(0x00);
-    Acc.setDataFormatControl(0x0B);
-    Acc.setDataRate(ADXL345_3200HZ);
-    Acc.setPowerControl(MeasurementMode);
-    
     while(1) {
         
         Gyro.read(Gyro_data);
         Acc.getOutput(Acc_data);
         
-        //LCD.cls(); // Display löschen
         LCD.locate(0,0);
         LCD.printf("%d %d %d |%d   ", Gyro_data[0],Gyro_data[1],Gyro_data[2],Gyro.readTemp()); //roll(x) pitch(y) yaw(z)
         LCD.locate(1,0);
-        //LCD.printf("%d|%d|%d %d", gmitt[0]/j,gmitt[1]/j,gmitt[2]/j,gyro.readTemp()); //roll pitch yaw
-        LCD.locate(1,0);
-        LCD.printf("%d %d %d       ", (int16_t)Acc_data[0],(int16_t)Acc_data[1],(int16_t)Acc_data[2]);
+        LCD.printf("%d %d %d %d   ", (int16_t)Acc_data[0],(int16_t)Acc_data[1],(int16_t)Acc_data[2], 1000 + abs((int16_t)Acc_data[1]));
         
-        j++;
+        if(abs((int16_t)Acc_data[0]) > 200)
+            Motor.initialize();
         
-        //Led[j%4] = !Led[j%4];
+        Motor = 1000 + abs((int16_t)Acc_data[1]); // Motorwert anpassen
         
+        LEDs.rollnext();
         wait(0.1);
         
     }