#include <ultrasonic.h>
◆ Ultrasonic()
| Device::Ultrasonic::Ultrasonic |
( |
Robot & | robot | ) |
|
|
explicit |
◆ ~Ultrasonic()
| Device::Ultrasonic::~Ultrasonic |
( |
| ) |
|
◆ get_distance()
| float Device::Ultrasonic::get_distance |
( |
| ) |
const |
|
inlinenodiscard |
Returns the distance in centimeters.
- Note
- If the distance was never read, this will return
-1
- Returns
- The distance in cm
◆ initialize()
| void Device::Ultrasonic::initialize |
( |
| ) |
|
Sets up the necessary GPIO pins.
◆ measure()
| void Device::Ultrasonic::measure |
( |
| ) |
|
Measures the distance of any object to the sensor.
- Note
- If the read times out, the internal distance variable will not be changed from the previous value
The documentation for this class was generated from the following files: