Sharp IR Distance Sensor

Dependents:   NavigationTest_ NavigationTest theRobotNEW theRobot ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Sharp.cpp Source File

Sharp.cpp

00001 #include "Sharp.h"
00002 #include "mbed.h"
00003 #include "math.h"
00004 
00005 Sharp::Sharp( PinName voutPin ):
00006 vout(voutPin)
00007 {    
00008 }
00009 
00010 double Sharp::getIRDistance(void)
00011 {
00012     float dist = vout.read();
00013     
00014     return 37.115*dist*dist-73.021*dist+43.451;
00015 }