Sharp GP2 familly distance sensor library
Dependents: FRC_2018 0hackton_08_06_18 0hackton_08_06_18_publish Kenya_2019 ... more
GP2A Class Reference
Includes : Mbed library. More...
#include <GP2A.h>
Public Member Functions | |
GP2A (PinName vmes, float dMin, float dMax, float slope, float origin=0) | |
Constructor of a Sharp GP2 Familly object. | |
double | getDistance (void) |
Return the distance to target mesured by sensor in cm. | |
double | getVoltage (void) |
Return the current voltage on GP2A output. | |
operator double () | |
A short hand of getDistance. |
Detailed Description
Includes : Mbed library.
GP2A Sensor : See sharp website for more informations http://www.sharp-world.com/products/device/lineup/selection/opto/haca/diagram.html
- Parameters:
-
slope = 60 for a GP2Y0A02 and 0.236 for a GP2Y0A21 origin = 0 for a GP2Y0A02 and -0.297 for a GP2Y0A21
Definition at line 71 of file GP2A.h.
Constructor & Destructor Documentation
GP2A | ( | PinName | vmes, |
float | dMin, | ||
float | dMax, | ||
float | slope, | ||
float | origin = 0 |
||
) |
Constructor of a Sharp GP2 Familly object.
- Parameters:
-
vmes (PinName) : the Mbed pin used to connect with GP2A sensor dMin (double) : the GP2A sensor min distance to mesure dMax (double) : the GP2A sensor max distance to mesure slope (double) : the slope of the linear part of the graph V = f(1/d) origin (double) : the origin (Y for X=0) of the linear pat of the graph V = f(1/d)
- Note:
- you better use slope and origin value that I've put above as sybolic constants
Member Function Documentation
double getDistance | ( | void | ) |
double getVoltage | ( | void | ) |
Generated on Tue Jul 19 2022 01:17:47 by 1.7.2