|
Smartcar Shield
|
#include <GP2D120.hpp>


Public Member Functions | |
| GP2D120 (Runtime &runtime, uint8_t pin) | |
| Constructs a GP2D120 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 GP2D120 infrared sensor. It can measure distances between 5 and 25 centimeters.
Definition at line 11 of file GP2D120.hpp.
| GP2D120::GP2D120 | ( | Runtime & | runtime, |
| uint8_t | pin | ||
| ) |
Constructs a GP2D120 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 GP2D120.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 GP2D120.cpp.

1.8.17