Class to handle triggering and reading the distance measured by a range finder.
Dependents: SeeedUltrasoundRangeFinder Ultrasonic_sensor_circle_ui riversensor Labo_TRSE_Drone ... more
RangeFinder Class Reference
Range Finder class. More...
#include <RangeFinder.h>
Public Member Functions | |
RangeFinder (PinName pin, int pulsetime, float scale, int timeout) | |
Create a RangeFinder object. | |
float | read_m () |
Return the distance to the nearest object, or -1.0 if reading the pulse timed out. |
Detailed Description
Range Finder class.
Definition at line 30 of file RangeFinder.h.
Constructor & Destructor Documentation
RangeFinder | ( | PinName | pin, |
int | pulsetime, | ||
float | scale, | ||
int | timeout | ||
) |
Create a RangeFinder object.
- Parameters:
-
pin Digital I/O pin the range finder is connected to. pulsetime Time of pulse to send to the rangefinder to trigger a measurement, in microseconds. scale Scaling of the range finder's output pulse from microseconds to metres. timeout Time to wait for a pulse from the range finder before giving up.
Definition at line 25 of file RangeFinder.cpp.
Member Function Documentation
float read_m | ( | ) |
Return the distance to the nearest object, or -1.0 if reading the pulse timed out.
Definition at line 32 of file RangeFinder.cpp.
Generated on Tue Jul 12 2022 12:27:23 by 1.7.2