ICRS Eurobot 2013
Dependencies: mbed mbed-rtos Servo QEI
Diff: Sensors/CakeSensor/CakeSensor.h
- Revision:
- 8:69bdf20cb525
- Child:
- 9:960410a01e6b
diff -r 56a5fdd373c9 -r 69bdf20cb525 Sensors/CakeSensor/CakeSensor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensors/CakeSensor/CakeSensor.h Thu Apr 04 19:37:05 2013 +0000 @@ -0,0 +1,20 @@ + +// Eurobot13 CakeSensor.h + +#include "mbed.h" + +class CakeSensor{ + private: + AnalogIn ain; + + public: + CakeSensor(PinName analoginpin) : ain(analoginpin){} + + float Distance(){return ain;} + + float Distanceincm(){ + float d = 5.5/(Distance()-0.13); + d = (d < 6 || d > 30)? -1:d; + return d; + } +};