Sharp IR Distance Sensor
Dependents: NavigationTest_ NavigationTest theRobotNEW theRobot ... more
Diff: Sharp.cpp
- Revision:
- 0:04f1a022d4d0
- Child:
- 1:a5ced48cfedc
diff -r 000000000000 -r 04f1a022d4d0 Sharp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sharp.cpp Thu Dec 12 19:25:15 2013 +0000 @@ -0,0 +1,15 @@ +#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; +} \ No newline at end of file