class for the ultrasonic ranging module HC-SR04
More...
#include <hc_sr04.h>
|
|
void | trig () |
| | send a trig signal to HCSR04
|
|
|
uint | trig_pin |
| | the GPIO pin that send trigger signal to the HC-SR04 module
|
|
uint | echo_pin |
| | the GPIO pin where the HC-SR04 return echo signal
|
class for the ultrasonic ranging module HC-SR04
◆ HCSR04()
| HCSR04::HCSR04 |
( |
uint | trig_pin, |
|
|
uint | echo_pin ) |
Construct a new hc sr04 object.
- Parameters
-
| trig_pin | the pin attached to the triggering signal |
| echo_pin | the pin used to measure round-trip time of ultrasonic pulses |
◆ get_distance()
| float HCSR04::get_distance |
( |
| ) |
|
request a measure from HCSR04
- Returns
- the measured distance in float[cm]. Max = 400cm. If no response, return = -1.
The documentation for this class was generated from the following files: