GPYX sensor library
Fork of Sharp by
Diff: Gp2x.cpp
- Revision:
- 2:e9ab384ccbab
- Parent:
- 1:a5ced48cfedc
diff -r a5ced48cfedc -r e9ab384ccbab Gp2x.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Gp2x.cpp Wed Feb 17 16:48:05 2016 +0000 @@ -0,0 +1,15 @@ +#include "Gp2x.h" +#include "mbed.h" +#include "math.h" + +Gp2x::Gp2x( PinName voutPin ): +vout(voutPin) +{ +} + +double Gp2x::getIRDistance(void) +{ + float dist = vout.read(); + + return 37.115*dist*dist-73.021*dist+43.451; +} \ No newline at end of file