GPYX sensor library

Fork of Sharp by UH Robotics

Committer:
j_j205
Date:
Wed Feb 17 16:48:05 2016 +0000
Revision:
2:e9ab384ccbab
Parent:
Sharp.cpp@1:a5ced48cfedc
2/17/16 JJ

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j_j205 2:e9ab384ccbab 1 #include "Gp2x.h"
tashworth 0:04f1a022d4d0 2 #include "mbed.h"
tashworth 0:04f1a022d4d0 3 #include "math.h"
tashworth 0:04f1a022d4d0 4
j_j205 2:e9ab384ccbab 5 Gp2x::Gp2x( PinName voutPin ):
tashworth 0:04f1a022d4d0 6 vout(voutPin)
tashworth 0:04f1a022d4d0 7 {
tashworth 0:04f1a022d4d0 8 }
tashworth 0:04f1a022d4d0 9
j_j205 2:e9ab384ccbab 10 double Gp2x::getIRDistance(void)
tashworth 0:04f1a022d4d0 11 {
tashworth 0:04f1a022d4d0 12 float dist = vout.read();
tashworth 0:04f1a022d4d0 13
tashworth 0:04f1a022d4d0 14 return 37.115*dist*dist-73.021*dist+43.451;
tashworth 0:04f1a022d4d0 15 }