GPYX sensor library

Fork of Sharp by UH Robotics

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Gp2x.cpp Source File

Gp2x.cpp

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