pub fn pulse(&self) -> Option<f64> {
        self.trigger.set_value(1);
        sleep(Duration::new(0, 10000));
        self.trigger.set_value(0);
        let ping_time = self.await_reading(1);
        match ping_time {
            Some(t) => {
                let cms = (t as f64 / SECOND_IN_NANOS as f64) * SPEED_OF_SOUND_CM as f64 / 2.0;
                Some(cms)
            }
            None => None,
        }
    }
/// Return the distance in centimeters that was measured by the sensor.
/// If there was no distance measured the result will be None.
Return the distance in centimeters that was measured by the sensor.
If there was no distance measured the result will be None.
Return the distance in centimeters that was measured by the sensor . If there was no distance measured the result will be None .
pub fn pulse(&self) -> Option<f64> {
        self.trigger.set_value(1);
        sleep(Duration::new(0, 10000));
        self.trigger.set_value(0);
        let ping_time = self.await_reading(1);
        match ping_time {
            Some(t) => {
                let cms = (t as f64 / SECOND_IN_NANOS as f64) * SPEED_OF_SOUND_CM as f64 / 2.0;
                Some(cms)
            }
            None => None,
        }
    }
pub fn pulse ( & self ) -> Option < f64 > { self . trigger . set_value ( 1 ) ; sleep ( Duration :: new ( 0 , 10000 ) ) ; self . trigger . set_value ( 0 ) ; let ping_time = self . await_reading ( 1 ) ; match ping_time { Some ( t ) => { let cms = ( t as f64 / SECOND_IN_NANOS as f64 ) * SPEED_OF_SOUND_CM as f64 / 2.0 ; Some ( cms ) } None => None , } }
Return the distance in centimeters that was measured by the sensor.
Return the distance in centimeters that was measured by the sensor .
&self
&self