Sharp IR Distance Sensor

Dependents:   NavigationTest_ NavigationTest theRobotNEW theRobot ... more

Sharp.cpp

Committer:
tashworth
Date:
2013-12-12
Revision:
0:04f1a022d4d0
Child:
1:a5ced48cfedc

File content as of revision 0:04f1a022d4d0:

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

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

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