NextDistanceSensor
Lightweight wrapper for a distance sensor that caches the last reading. Call update in periodic to read the hardware.
Use isWithinDistance to check if an object is close enough.
Example:
override fun periodic() {
sensor.update()
if (sensor.isWithinDistance(6.7)) { ... }
}Content copied to clipboard
Author
28shettr
Parameters
initializer
Lazily resolves the backing DistanceSensor.
Functions
Link copied to clipboard
Returns the last cached distance converted to the requested unit.
Link copied to clipboard