![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
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; + } +};