Sharp IR Distance Sensor

Dependents:   NavigationTest_ NavigationTest theRobotNEW theRobot ... more

Sharp.cpp

Committer:
tashworth
Date:
2014-03-28
Revision:
1:a5ced48cfedc
Parent:
0:04f1a022d4d0

File content as of revision 1:a5ced48cfedc:

#include "Sharp.h"
#include "mbed.h"
#include "math.h"

Sharp::Sharp( PinName voutPin ):
vout(voutPin)
{    
}

double Sharp::getIRDistance(void)
{
    float dist = vout.read();
    
    return 37.115*dist*dist-73.021*dist+43.451;
}