Interface class for the Max Botix ultrasonic range finder model 1210. It includes input methods for PWM, Analog, and Serial. A PwmIn class was created to allow the PWM input to be read. Now includes automatic range update via interrupts.
Diff: PwmIn/PwmIn.h
- Revision:
- 0:3d969e0b4ca0
- Child:
- 2:997b4057c879
diff -r 000000000000 -r 3d969e0b4ca0 PwmIn/PwmIn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PwmIn/PwmIn.h Sun Aug 22 21:18:20 2010 +0000 @@ -0,0 +1,27 @@ +#ifndef PwmInLibrary +#define PwmInLibrary + +#include "stdint.h" +#include "mbed.h" + +class PwmIn : private InterruptIn, Timer +{ + private: + unsigned int PeriodMeasurement; + unsigned int PulseWidthMeasurement; + + void PulseStart(); + void PulseStop(); + + public: + PwmIn(PinName pwi); + float read(); + float period(); + int period_ms(); + int period_us(); + float pulsewidth(); + int pulsewidth_ms(); + int pulsewidth_us(); +}; + +#endif \ No newline at end of file