Marco Friedmann / Mbed 2 deprecated Quadrocopter2

Dependencies:   mbed TextLCD

Fork of Quadrocopter by Chris Elsholz

Revision:
10:16ca5e9ee0dc
Parent:
9:9185d37e061f
Child:
11:8457b851e3e1
--- a/main.cpp	Tue Aug 08 08:32:25 2017 +0000
+++ b/main.cpp	Tue Aug 08 16:53:22 2017 +0000
@@ -7,10 +7,10 @@
 static SPI spi(PE_6,PE_5,PE_2);  //mosi,miso,sclk
 static DigitalOut ncs(PE_4);    //ssel
 
-static AnalogIn potis_1 (PF_3);
-static AnalogIn potis_2 (PF_10);
-static AnalogIn potis_3 (PF_4);
-static AnalogIn potis_4 (PF_5);
+static AnalogIn poti_1 (PF_3);
+static AnalogIn poti_2 (PF_10);
+static AnalogIn poti_3 (PF_4);
+static AnalogIn poti_4 (PF_5);
 
 static DigitalIn taster1 (PG_7);
 static DigitalIn taster2 (PD_10);
@@ -26,42 +26,40 @@
 static DigitalOut db6(PC_14);
 static DigitalOut db7(PC_15);
 
-PwmOut Motor2 (PC_9);       //  Weiß
-PwmOut Motor1 (PC_8);       //  Schwarz
-PwmOut Motor3 (PC_6);       //  Grau
-PwmOut Motor4 (PB_9);       //  Blau
-                            //  Gelb und Orange Vcc +5V 
-                            //  Gnd Rot
+static PwmOut Motor2 (PC_9);       //  Weiß
+static PwmOut Motor1 (PC_8);       //  Schwarz
+static PwmOut Motor3 (PC_6);       //  Grau
+static PwmOut Motor4 (PB_9);       //  Blau
+                                //  Gelb und Orange Vcc +5V 
+                                //  Gnd Rot
 
 
 int main()
 { 
 
-float winkel1, winkel2;
+Motor1.period_ms(2);
+Motor2.period_ms(2);
+Motor3.period_ms(2);
+Motor4.period_ms(2);
 
-initialisierung_gyro();
-initialisierung_acc ();
+
 pc.printf("\n\r");
     while(1)
-    {
-        #include "mbed.h"
+    {   
+        Motor3.pulsewidth_us(poti_1.read_u16()*0.015305732*2);
+        pc.printf("Poti = %2.2f\r",poti_1.read_u16()*0.015305732); 
+    }
+}
 
-        PwmOut PWM (PB_11);
-        AnalogIn poti (PA_6);
- 
+
+
 
-        {
-        PWM = poti.read();
-        pc.printf("%f\n\r", poti.read());
-        }   
-        
+
+/*
         float x = aktuell_acc_x ();
         float z = aktuell_acc_z ();
         winkel1 = (((float)atan2(x, z)));
         float y = aktuell_acc_y ();
         winkel2 = (((float)atan2(y, z)));
-
-
-        pc.printf("%4.2f\t\t\t%4.2f\t\r",winkel1*360/6.28, winkel2*360/6.28);
-    }
-}
\ No newline at end of file
+        
+        pc.printf("%4.2f\t\t\t%4.2f\t\r",winkel1*360/6.28, winkel2*360/6.28);*/
\ No newline at end of file