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@15:753c5d6a63b3, 2012-10-29 (annotated)
- Committer:
- maetugr
- Date:
- Mon Oct 29 16:43:10 2012 +0000
- Revision:
- 15:753c5d6a63b3
- Parent:
- 12:67a06c9b69d5
- Child:
- 27:9e546fa47c33
I2C/Interrupt-Problem gel?st!! erste Versuche an gespannter schnur, falsche PID werte mitten im umschreiben auf I2C_Sensor mutterklasse
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 | 7:9d4313510646 | 5 | |
maetugr | 7:9d4313510646 | 6 | class RC_Channel |
maetugr | 7:9d4313510646 | 7 | { |
maetugr | 7:9d4313510646 | 8 | public: |
maetugr | 10:953afcbcebfc | 9 | RC_Channel(PinName mypin); // NO p19/p20!!!!, they don't support InterruptIn |
maetugr | 10:953afcbcebfc | 10 | int read(); // read the last measured data |
maetugr | 7:9d4313510646 | 11 | |
maetugr | 7:9d4313510646 | 12 | private: |
maetugr | 10:953afcbcebfc | 13 | InterruptIn myinterrupt; // interrupt on the pin to react when signal falls or rises |
maetugr | 10:953afcbcebfc | 14 | void rise(); // start the time measurement when signal rises |
maetugr | 10:953afcbcebfc | 15 | void fall(); // stop the time mesurement and save the value when signal falls |
maetugr | 10:953afcbcebfc | 16 | Timer timer; // timer to measure the up time of the signal and if the signal timed out |
maetugr | 10:953afcbcebfc | 17 | int time; // last measurement data |
maetugr | 10:953afcbcebfc | 18 | |
maetugr | 10:953afcbcebfc | 19 | Ticker timeoutchecker; // Ticker to see if signal broke down |
maetugr | 10:953afcbcebfc | 20 | void timeoutcheck(); // to check for timeout, checked every second |
maetugr | 7:9d4313510646 | 21 | }; |
maetugr | 7:9d4313510646 | 22 | |
maetugr | 7:9d4313510646 | 23 | #endif |