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.
RC/RC_Channel.h@12:67a06c9b69d5, 2012-10-20 (annotated)
- Committer:
- maetugr
- Date:
- Sat Oct 20 17:28:28 2012 +0000
- Revision:
- 12:67a06c9b69d5
- Parent:
- 10:953afcbcebfc
- Child:
- 15:753c5d6a63b3
mit unterbrochenem RC signal, kompass fertig mit speicherung!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maetugr | 7:9d4313510646 | 1 | #ifndef RC_CHANNEL_H |
maetugr | 7:9d4313510646 | 2 | #define RC_CHANNEL_H |
maetugr | 7:9d4313510646 | 3 | |
maetugr | 7:9d4313510646 | 4 | #include "mbed.h" |
maetugr | 12:67a06c9b69d5 | 5 | #include "LED.h" |
maetugr | 7:9d4313510646 | 6 | |
maetugr | 7:9d4313510646 | 7 | class RC_Channel |
maetugr | 7:9d4313510646 | 8 | { |
maetugr | 7:9d4313510646 | 9 | public: |
maetugr | 10:953afcbcebfc | 10 | RC_Channel(PinName mypin); // NO p19/p20!!!!, they don't support InterruptIn |
maetugr | 10:953afcbcebfc | 11 | int read(); // read the last measured data |
maetugr | 7:9d4313510646 | 12 | |
maetugr | 7:9d4313510646 | 13 | private: |
maetugr | 10:953afcbcebfc | 14 | InterruptIn myinterrupt; // interrupt on the pin to react when signal falls or rises |
maetugr | 10:953afcbcebfc | 15 | void rise(); // start the time measurement when signal rises |
maetugr | 10:953afcbcebfc | 16 | void fall(); // stop the time mesurement and save the value when signal falls |
maetugr | 10:953afcbcebfc | 17 | Timer timer; // timer to measure the up time of the signal and if the signal timed out |
maetugr | 10:953afcbcebfc | 18 | int time; // last measurement data |
maetugr | 10:953afcbcebfc | 19 | |
maetugr | 12:67a06c9b69d5 | 20 | LED LEDs; |
maetugr | 12:67a06c9b69d5 | 21 | |
maetugr | 10:953afcbcebfc | 22 | Ticker timeoutchecker; // Ticker to see if signal broke down |
maetugr | 10:953afcbcebfc | 23 | void timeoutcheck(); // to check for timeout, checked every second |
maetugr | 7:9d4313510646 | 24 | }; |
maetugr | 7:9d4313510646 | 25 | |
maetugr | 7:9d4313510646 | 26 | #endif |