ICRS Eurobot 2013

Dependencies:   mbed mbed-rtos Servo QEI

Sensors/CakeSensor/CakeSensor.h

Committer:
twighk
Date:
2013-04-04
Revision:
8:69bdf20cb525
Child:
9:960410a01e6b

File content as of revision 8:69bdf20cb525:


// 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;
    }
};