|
Smartcar Shield
|
#include <GP2Y0A02.hpp>


Public Member Functions | |
| GP2Y0A02 (Runtime &runtime, uint8_t pin) | |
| Constructs a GP2Y0A02 sensor. More... | |
| unsigned int | getDistance () override |
| Gets the distance measured by the sensor in centimeters. More... | |
Public Member Functions inherited from InfraredAnalogSensor | |
| InfraredAnalogSensor (Runtime &runtime) | |
| unsigned int | getMedianDistance (uint8_t iterations=smartcarlib::constants::analogInfraredSensor::kDefaultIterations) override |
| Gets the median distance from the specified number of measurements. More... | |
Public Member Functions inherited from DistanceSensor | |
| virtual | ~DistanceSensor ()=default |
Programmatically represents a SHARP GP2Y0A02 infrared sensor. It can measure distances between 25 and 120 centimeters.
Definition at line 11 of file GP2Y0A02.hpp.
| GP2Y0A02::GP2Y0A02 | ( | Runtime & | runtime, |
| uint8_t | pin | ||
| ) |
Constructs a GP2Y0A02 sensor.
| runtime | The runtime environment you want to run the class for |
| pin | The analog pin receiving sensor signals |
Example:
Definition at line 9 of file GP2Y0A02.cpp.
|
overridevirtual |
Gets the distance measured by the sensor in centimeters.
Calling this might trigger a new measurement by the sensor.
0 if an error has occured, otherwise the measured distance in centimetersExample:
Implements DistanceSensor.
Definition at line 16 of file GP2Y0A02.cpp.

1.8.17