[−][src]Struct ev3dev_lang_rust::sensors::UltrasonicSensor
LEGO EV3 ultrasonic sensor.
Methods
impl UltrasonicSensor
[src]
pub fn get(port: SensorPort) -> Ev3Result<Self>
[src]
Try to get a Self
on the given port. Returns None
if port is not used or another device is connected.
pub fn find() -> Ev3Result<Self>
[src]
Try to find a Self
. Only returns a motor if their is exactly one connected, Error::NotFound
otherwise.
pub fn list() -> Ev3Result<Vec<Self>>
[src]
Extract list of connected 'Self'
pub const MODE_US_DIST_CM: &'static str
[src]
Continuous measurement - sets LEDs on, steady. Units in centimeters. Distance (0-2550)
pub const MODE_US_DIST_IN: &'static str
[src]
Continuous measurement - sets LEDs on, steady. Units in inches. Distance (0-1003)
pub const MODE_US_LISTEN: &'static str
[src]
Listen - sets LEDs on, blinking. Presence (0-1)
pub const MODE_US_SI_CM: &'static str
[src]
Single measurement - LEDs on momentarily when mode is set, then off. Units in centimeters. Distance (0-2550)
pub const MODE_US_SI_IN: &'static str
[src]
Single measurement - LEDs on momentarily when mode is set, then off. Units in inches. Distance (0-1003)
pub const MODE_US_DC_CM: &'static str
[src]
??? - sets LEDs on, steady. Units in centimeters. Distance (0-2550)
pub const MODE_US_DC_IN: &'static str
[src]
??? - sets LEDs on, steady. Units in inches. Distance (0-1003)
pub fn get_bin_data(&self) -> Ev3Result<String>
[src]
Reading the file will give the unscaled raw values in the value<N>
attributes.
Use bin_data_format
, num_values
and the individual sensor documentation to determine how to interpret the data.
pub fn get_bin_data_format(&self) -> Ev3Result<String>
[src]
Returns the format of the values in bin_data
for the current mode. Possible values are:
pub fn get_decimals(&self) -> Ev3Result<i32>
[src]
Returns the number of decimal places for the values in the value<N>
attributes of the current mode.
pub fn get_fw_version(&self) -> Ev3Result<String>
[src]
Returns the firmware version of the sensor if available. Currently only NXT/I2C sensors support this.
pub fn get_mode(&self) -> Ev3Result<String>
[src]
Returns the current mode. See the individual sensor documentation for a description of the modes available for each type of sensor.
pub fn set_mode(&self, mode: &str) -> Ev3Result<()>
[src]
Sets the sensor to that mode. See the individual sensor documentation for a description of the modes available for each type of sensor.
pub fn get_modes(&self) -> Ev3Result<Vec<String>>
[src]
Returns a list of the valid modes for the sensor.
pub fn get_num_values(&self) -> Ev3Result<i32>
[src]
Returns the number of value<N>
attributes that will return a valid value for the current mode.
pub fn get_poll_ms(&self) -> Ev3Result<i32>
[src]
Returns the polling period of the sensor in milliseconds.
Returns -EOPNOTSUPP
if changing polling is not supported.
Note: Setting poll_ms too high can cause the input port autodetection to fail.
If this happens, use the mode attribute of the port to force the port to nxt-i2c mode
. Values must not be negative.
pub fn set_poll_ms(&self, poll_ms: i32) -> Ev3Result<()>
[src]
Sets the polling period of the sensor in milliseconds.
Setting to 0 disables polling.
Note: Setting poll_ms too high can cause the input port autodetection to fail.
If this happens, use the mode attribute of the port to force the port to nxt-i2c mode
. Values must not be negative.
pub fn get_units(&self) -> Ev3Result<String>
[src]
Returns the units of the measured value for the current mode. May return empty string if units are unknown.
pub fn get_value0(&self) -> Ev3Result<i32>
[src]
Returns the current value0
value if available.
pub fn get_value1(&self) -> Ev3Result<i32>
[src]
Returns the current value1
value if available.
pub fn get_value2(&self) -> Ev3Result<i32>
[src]
Returns the current value2
value if available.
pub fn get_value3(&self) -> Ev3Result<i32>
[src]
Returns the current value3
value if available.
pub fn get_value4(&self) -> Ev3Result<i32>
[src]
Returns the current value4
value if available.
pub fn get_value5(&self) -> Ev3Result<i32>
[src]
Returns the current value5
value if available.
pub fn get_value6(&self) -> Ev3Result<i32>
[src]
Returns the current value6
value if available.
pub fn get_value7(&self) -> Ev3Result<i32>
[src]
Returns the current value7
value if available.
pub fn get_text_value(&self) -> Ev3Result<String>
[src]
Returns a space delimited string representing sensor-specific text values. Returns -EOPNOTSUPP
if a sensor does not support text values.
pub fn set_mode_us_dist_cm(&self) -> Ev3Result<()>
[src]
Continuous measurement - sets LEDs on, steady. Units in centimeters. Distance (0-2550)
pub fn set_mode_us_dist_in(&self) -> Ev3Result<()>
[src]
Continuous measurement - sets LEDs on, steady. Units in inches. Distance (0-1003)
pub fn set_mode_us_listen(&self) -> Ev3Result<()>
[src]
Listen - sets LEDs on, blinking. Presence (0-1)
pub fn set_mode_us_si_cm(&self) -> Ev3Result<()>
[src]
Single measurement - LEDs on momentarily when mode is set, then off. Units in centimeters. Distance (0-2550)
pub fn set_mode_us_si_in(&self) -> Ev3Result<()>
[src]
Single measurement - LEDs on momentarily when mode is set, then off. Units in inches. Distance (0-1003)
pub fn set_mode_us_dc_cm(&self) -> Ev3Result<()>
[src]
??? - sets LEDs on, steady . Units in centimeters. Distance (0-2550)
pub fn set_mode_us_dc_in(&self) -> Ev3Result<()>
[src]
??? - sets LEDs on, steady . Units in inches. Distance (0-1003)
pub fn get_distance(&self) -> Ev3Result<i32>
[src]
Measurement of the distance detected by the sensor
Trait Implementations
impl Clone for UltrasonicSensor
[src]
fn clone(&self) -> UltrasonicSensor
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for UltrasonicSensor
[src]
impl Device for UltrasonicSensor
[src]
fn get_attribute(&self, name: &str) -> Attribute
[src]
fn get_address(&self) -> Ev3Result<String>
[src]
fn set_command(&self, command: &str) -> Ev3Result<()>
[src]
fn get_commands(&self) -> Ev3Result<Vec<String>>
[src]
fn get_driver_name(&self) -> Ev3Result<String>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for UltrasonicSensor
impl !Send for UltrasonicSensor
impl !Sync for UltrasonicSensor
impl Unpin for UltrasonicSensor
impl !UnwindSafe for UltrasonicSensor
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,