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
main.cpp
- Committer:
- MarcoF89
- Date:
- 2017-08-08
- Revision:
- 9:9185d37e061f
- Parent:
- 8:769ff3814355
- Child:
- 10:16ca5e9ee0dc
File content as of revision 9:9185d37e061f:
#include "mbed.h" #include "stdio.h" #include <Timer.h> #include "messen.h" static Serial pc(SERIAL_TX, SERIAL_RX); 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 DigitalIn taster1 (PG_7); static DigitalIn taster2 (PD_10); static DigitalIn taster3 (PG_14); static DigitalIn taster4 (PF_12); static DigitalOut db0(PC_8); static DigitalOut db1(PC_9); static DigitalOut db2(PC_10); static DigitalOut db3(PC_11); static DigitalOut db4(PC_12); static DigitalOut db5(PC_13); 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) { #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); } }