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.
Revision 32:e2e02338805e, committed 2013-04-02
- Comitter:
- maetugr
- Date:
- Tue Apr 02 16:57:56 2013 +0000
- Parent:
- 31:872d8b8c7812
- Child:
- 33:fd98776b6cc7
- Commit message:
- version of the testvideo: http://www.youtube.com/watch?v=UMTZ6K-T_kc
Changed in this revision
--- a/LED.lib Sat Mar 30 09:17:44 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -LED#eb31b1718ac1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED/LED.cpp Tue Apr 02 16:57:56 2013 +0000 @@ -0,0 +1,60 @@ +#include "LED.h" +#include "mbed.h" + +LED::LED() : Led(LED1, LED2, LED3, LED4){ + roller = 0; +} + +void LED::shownumber(int number) { + Led = number; +} + +void LED::ride(int times = 1) { + Led = 0; + for (int j = 0; j < times; j++) { + for(int i=0; i < 4; i++) { + Led = 1 << i; + wait(0.2); + } + } + Led = 0; +} + +void LED::roll(int times = 1) { + Led = 0; + for (int j = 0; j < (times*2); j++) { + for(int roller = 1; roller <= 4; roller++) { + tilt(roller); + wait(0.1); + } + } + roller = 0; + Led = 0; +} + +void LED::rollnext() { + if (roller >= 4) + roller = 0; + roller++; + tilt(roller); +} + +void LED::tilt(int index) { + Led = Led ^ (1 << (index-1)); //XOR +} + +void LED::set(int index) { + Led = Led | (1 << (index-1)); //OR +} + +void LED::reset(int index) { + Led = Led & ~(1 << (index-1)); //OR +} + +int LED::check(int index) { + return Led & (1 << (index-1)); +} + +void LED::operator=(int value) { + Led = value; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LED/LED.h Tue Apr 02 16:57:56 2013 +0000 @@ -0,0 +1,27 @@ +// by MaEtUgR + +#ifndef LED_H +#define LED_H + +#include "mbed.h" + +class LED { + + public: + LED(); + void shownumber(int number); + void ride(int times); + void roll(int times); + void rollnext(); + void tilt(int index); + void set(int index); + void reset(int index); + int check(int index); + void operator=(int value); + + private: + BusOut Led; + int roller; +}; + +#endif \ No newline at end of file
--- a/main.cpp Sat Mar 30 09:17:44 2013 +0000 +++ b/main.cpp Tue Apr 02 16:57:56 2013 +0000 @@ -14,7 +14,7 @@ #define RATE 0.002 // speed of the interrupt for Sensors and PID #define PPM_FREQU 495 // Hz Frequency of PPM Signal for ESCs (maximum <500Hz) #define MAXPITCH 40 // maximal angle from horizontal that the PID is aming for -#define RC_SENSITIVITY 20 +#define RC_SENSITIVITY 30 #define YAWSPEED 2 // maximal speed of yaw rotation in degree per Rate float P = 1.5; // PID values @@ -30,8 +30,8 @@ // initialisation of hardware (see includes for more info) LED LEDs; #ifdef PC_CONNECTED - PC pc(USBTX, USBRX, 115200); // USB - //PC pc(p9, p10, 115200); // Bluetooth + //PC pc(USBTX, USBRX, 115200); // USB + PC pc(p9, p10, 115200); // Bluetooth #endif LocalFileSystem local("local"); // Create the local filesystem under the name "local" //FILE *Logger;