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.
Diff: LED/LED.cpp
- Revision:
- 1:5a64632b1eb9
- Parent:
- 0:0c4fafa398b4
- Child:
- 8:d25ecdcdbeb5
--- a/LED/LED.cpp Wed Sep 26 12:15:00 2012 +0000 +++ b/LED/LED.cpp Fri Sep 28 13:24:03 2012 +0000 @@ -1,21 +1,49 @@ #include "LED.h" #include "mbed.h" -LED::LED() : Led(LED1, LED2, LED3, LED4){ } +LED::LED() : Led(LED1, LED2, LED3, LED4){ + roller = 0; +} void LED::shownumber(int number) { Led = number; } -void LED::roll(int times = 1) { +void LED::ride(int times = 1) { + Led = 0; for (int j = 0; j < times; j++) { - for(int i=0; i<4; i++) { + for(int i=0; i < 4; i++) { Led = 1 << i; - wait(0.25); + 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; + else + roller++; + tilt(roller); } void LED::tilt(int index) { Led = Led^(1 << (index-1)); +} + +void LED::operator=(int value) { + Led = value; } \ No newline at end of file