Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Quadrocopter by
Revision 9:9185d37e061f, committed 2017-08-08
- 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
--- 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
