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: RC/RC_Channel.cpp
- Revision:
- 12:67a06c9b69d5
- Parent:
- 10:953afcbcebfc
- Child:
- 15:753c5d6a63b3
diff -r 9bf69bc6df45 -r 67a06c9b69d5 RC/RC_Channel.cpp --- a/RC/RC_Channel.cpp Thu Oct 18 20:04:16 2012 +0000 +++ b/RC/RC_Channel.cpp Sat Oct 20 17:28:28 2012 +0000 @@ -6,7 +6,8 @@ time = -1; // start value to see if there was any value yet myinterrupt.rise(this, &RC_Channel::rise); myinterrupt.fall(this, &RC_Channel::fall); - timeoutchecker.attach(this, &RC_Channel::timeoutcheck, 1); + //timeoutchecker.attach(this, &RC_Channel::timeoutcheck, 1); + } int RC_Channel::read() @@ -17,12 +18,16 @@ void RC_Channel::rise() { timer.start(); + LEDs.set(2); } void RC_Channel::fall() { timer.stop(); - time = timer.read_us(); + LEDs.reset(2); + int tester = timer.read_us(); + if(tester >= 1000 && tester <=2000) + time = tester; timer.reset(); timer.start(); }