Used to read incoming PWM signals from RC channels
PulseIn.h
- Committer:
- KarimAzzouz
- Date:
- 2012-12-19
- Revision:
- 0:1a57c7f88422
- Child:
- 1:eaf70ff4df07
File content as of revision 0:1a57c7f88422:
#ifndef RC_CHANNEL_H #define PULSEIN_H #include "mbed.h" class PulseIn { public: PulseIn(PinName p); int read(); // read the last measured data private: InterruptIn _k; // interrupt on the pin to react when signal falls or rises void rise(); // start the time measurement when signal rises void fall(); // stop the time mesurement and save the value when signal falls Timer t; // timer to measure the up time of the signal and if the signal timed out int _duration; // last measurement data }; #endif