Marco Friedmann / Mbed 2 deprecated Quadrocopter2

Dependencies:   mbed TextLCD

Fork of Quadrocopter by Chris Elsholz

Files at this revision

API Documentation at this revision

Comitter:
MarcoF89
Date:
Tue Aug 08 08:32:25 2017 +0000
Parent:
8:769ff3814355
Child:
10:16ca5e9ee0dc
Commit message:
Steckerbelegung zum Q-Brain

Changed in this revision

display/display.cpp Show annotated file Show diff for this revision Revisions of this file
display/display.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Aug 06 21:17:29 2017 +0000
+++ b/main.cpp	Tue Aug 08 08:32:25 2017 +0000
@@ -26,14 +26,42 @@
 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
+
 
 int main()
 { 
+
+float winkel1, winkel2;
+
 initialisierung_gyro();
 initialisierung_acc ();
+pc.printf("\n\r");
     while(1)
     {
-        pc.printf("\n\r");
-        pc.printf("%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t\r",aktuell_gyro_z(), aktuell_gyro_x(), aktuell_gyro_y(), aktuell_acc_x (), aktuell_acc_y (), aktuell_acc_z ());
+        #include "mbed.h"
+
+        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
--- a/mbed.bld	Sun Aug 06 21:17:29 2017 +0000
+++ b/mbed.bld	Tue Aug 08 08:32:25 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/a97add6d7e64
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d
\ No newline at end of file