GPYX sensor library

Fork of Sharp by UH Robotics

Gp2x.cpp

Committer:
j_j205
Date:
2016-02-17
Revision:
2:e9ab384ccbab
Parent:
Sharp.cpp@ 1:a5ced48cfedc

File content as of revision 2:e9ab384ccbab:

#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;
}