Mouse code for the MacroRat
Diff: irpair.h
- Revision:
- 6:3d68fedd6fd9
- Child:
- 9:1d8e4da058cd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irpair.h Thu May 04 21:38:20 2017 +0000 @@ -0,0 +1,29 @@ +#ifndef IRPAIR_H +#define IRPAIR_H + +#include "mbed.h" + +#define samplesToTake 1000 + +class IRPair +{ + public: + IRPair( PinName pin, PinName rec ) : ir( pin ), recv( rec ) + { + calibrateSensor(); + } + + float getSamples( int i ); + + private: + void calibrateSensor(); + + // internal values + DigitalOut ir; + AnalogIn recv; + float sensorAvg; +}; + + + +#endif \ No newline at end of file