Function uugear_ffi::readSR04[][src]

pub unsafe extern "C" fn readSR04(
    dev: *mut UUGearDevice,
    trigPin: c_int,
    echoPin: c_int
) -> f32

Read distance value (in cm) from HC-SR04 sensor

parameters: dev is the pointer of the device struct trigPin is the digital pin that connects to the TRIG wire of SR04 echoPin is the digital pin that connects to the ECHO wire of SR04 echoPin could be the same than trigPin if you wire them together.

returns: float value of the distance in cm you may need to check if it is in the correct range by yourself.