Struct ev3dev_lang_rust::sensors::HiTechnicColorSensor
source · pub struct HiTechnicColorSensor { /* private fields */ }Expand description
HiTechnic NXT Color Sensor V2
Implementations§
source§impl HiTechnicColorSensor
impl HiTechnicColorSensor
sourcepub fn get(port: SensorPort) -> Ev3Result<Self>
pub fn get(port: SensorPort) -> Ev3Result<Self>
Try to get a Self on the given port. Returns None if port is not used or another device is connected.
sourcepub fn find() -> Ev3Result<Self>
pub fn find() -> Ev3Result<Self>
Try to find a Self. Only returns a motor if their is exactly one connected, Error::NotFound otherwise.
sourcepub const MODE_COL_REFLECT: &'static str = "COL-REFLECT"
pub const MODE_COL_REFLECT: &'static str = "COL-REFLECT"
Reflected light - sets LED color to red
sourcepub fn set_mode_col_reflect(&self) -> Ev3Result<()>
pub fn set_mode_col_reflect(&self) -> Ev3Result<()>
Reflected light - sets LED color to red
sourcepub fn is_mode_col_reflect(&self) -> Ev3Result<bool>
pub fn is_mode_col_reflect(&self) -> Ev3Result<bool>
Reflected light - sets LED color to red
sourcepub const MODE_COL_AMBIENT: &'static str = "COL-AMBIENT"
pub const MODE_COL_AMBIENT: &'static str = "COL-AMBIENT"
Ambient light - sets LED color to blue (dimly lit)
sourcepub fn set_mode_col_ambient(&self) -> Ev3Result<()>
pub fn set_mode_col_ambient(&self) -> Ev3Result<()>
Ambient light - sets LED color to blue (dimly lit)
sourcepub fn is_mode_col_ambient(&self) -> Ev3Result<bool>
pub fn is_mode_col_ambient(&self) -> Ev3Result<bool>
Ambient light - sets LED color to blue (dimly lit)
sourcepub const MODE_COL_COLOR: &'static str = "COL-COLOR"
pub const MODE_COL_COLOR: &'static str = "COL-COLOR"
Color - sets LED color to white (all LEDs rapidly cycling)
sourcepub fn set_mode_col_color(&self) -> Ev3Result<()>
pub fn set_mode_col_color(&self) -> Ev3Result<()>
Color - sets LED color to white (all LEDs rapidly cycling)
sourcepub fn is_mode_col_color(&self) -> Ev3Result<bool>
pub fn is_mode_col_color(&self) -> Ev3Result<bool>
Color - sets LED color to white (all LEDs rapidly cycling)
sourcepub const MODE_REF_RAW: &'static str = "REF-RAW"
pub const MODE_REF_RAW: &'static str = "REF-RAW"
Raw Reflected - sets LED color to red
sourcepub fn set_mode_ref_raw(&self) -> Ev3Result<()>
pub fn set_mode_ref_raw(&self) -> Ev3Result<()>
Raw Reflected - sets LED color to red
sourcepub fn is_mode_ref_raw(&self) -> Ev3Result<bool>
pub fn is_mode_ref_raw(&self) -> Ev3Result<bool>
Raw Reflected - sets LED color to red
sourcepub const MODE_RGB_RAW: &'static str = "RAW"
pub const MODE_RGB_RAW: &'static str = "RAW"
Raw Color Components - sets LED color to white (all LEDs rapidly cycling)
sourcepub fn set_mode_rgb_raw(&self) -> Ev3Result<()>
pub fn set_mode_rgb_raw(&self) -> Ev3Result<()>
Raw Color Components - sets LED color to white (all LEDs rapidly cycling)
sourcepub fn is_mode_rgb_raw(&self) -> Ev3Result<bool>
pub fn is_mode_rgb_raw(&self) -> Ev3Result<bool>
Raw Color Components - sets LED color to white (all LEDs rapidly cycling)
sourcepub const MODE_COL_CAL: &'static str = "COL-CAL"
pub const MODE_COL_CAL: &'static str = "COL-CAL"
Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous
sourcepub fn set_mode_col_cal(&self) -> Ev3Result<()>
pub fn set_mode_col_cal(&self) -> Ev3Result<()>
Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous
sourcepub fn is_mode_col_cal(&self) -> Ev3Result<bool>
pub fn is_mode_col_cal(&self) -> Ev3Result<bool>
Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous
sourcepub fn get_color(&self) -> Ev3Result<i32>
pub fn get_color(&self) -> Ev3Result<i32>
Get the color value for the modes COL-REFLECT, COL-AMBIENT, COL-COLOR and REF-RAW.
sourcepub fn get_red(&self) -> Ev3Result<i32>
pub fn get_red(&self) -> Ev3Result<i32>
Red component of the detected color, in the range 0-1020.
sourcepub fn get_green(&self) -> Ev3Result<i32>
pub fn get_green(&self) -> Ev3Result<i32>
Green component of the detected color, in the range 0-1020.
sourcepub fn get_blue(&self) -> Ev3Result<i32>
pub fn get_blue(&self) -> Ev3Result<i32>
Blue component of the detected color, in the range 0-1020.
Trait Implementations§
source§impl Clone for HiTechnicColorSensor
impl Clone for HiTechnicColorSensor
source§fn clone(&self) -> HiTechnicColorSensor
fn clone(&self) -> HiTechnicColorSensor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for HiTechnicColorSensor
impl Debug for HiTechnicColorSensor
source§impl Device for HiTechnicColorSensor
impl Device for HiTechnicColorSensor
source§fn get_attribute(&self, name: &str) -> Attribute
fn get_attribute(&self, name: &str) -> Attribute
source§fn get_address(&self) -> Ev3Result<String>
fn get_address(&self) -> Ev3Result<String>
source§fn set_command(&self, command: &str) -> Ev3Result<()>
fn set_command(&self, command: &str) -> Ev3Result<()>
source§fn get_commands(&self) -> Ev3Result<Vec<String>>
fn get_commands(&self) -> Ev3Result<Vec<String>>
source§fn get_driver_name(&self) -> Ev3Result<String>
fn get_driver_name(&self) -> Ev3Result<String>
source§impl Sensor for HiTechnicColorSensor
impl Sensor for HiTechnicColorSensor
source§fn get_bin_data(&self) -> Ev3Result<String>
fn get_bin_data(&self) -> Ev3Result<String>
value<N> attributes.
Use bin_data_format, num_values and the individual sensor documentation to determine how to interpret the data.source§fn get_bin_data_format(&self) -> Ev3Result<String>
fn get_bin_data_format(&self) -> Ev3Result<String>
bin_data for the current mode. Possible values are:source§fn get_decimals(&self) -> Ev3Result<i32>
fn get_decimals(&self) -> Ev3Result<i32>
value<N> attributes of the current mode.source§fn get_fw_version(&self) -> Ev3Result<String>
fn get_fw_version(&self) -> Ev3Result<String>
source§fn get_mode(&self) -> Ev3Result<String>
fn get_mode(&self) -> Ev3Result<String>
source§fn set_mode(&self, mode: &str) -> Ev3Result<()>
fn set_mode(&self, mode: &str) -> Ev3Result<()>
source§fn get_modes(&self) -> Ev3Result<Vec<String>>
fn get_modes(&self) -> Ev3Result<Vec<String>>
source§fn get_num_values(&self) -> Ev3Result<i32>
fn get_num_values(&self) -> Ev3Result<i32>
value<N> attributes that will return a valid value for the current mode.source§fn get_poll_ms(&self) -> Ev3Result<i32>
fn get_poll_ms(&self) -> Ev3Result<i32>
-EOPNOTSUPP if changing polling is not supported.
Note: Setting poll_ms too high can cause the input port auto detection 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.source§fn set_poll_ms(&self, poll_ms: i32) -> Ev3Result<()>
fn set_poll_ms(&self, poll_ms: i32) -> Ev3Result<()>
nxt-i2c mode. Values must not be negative.source§fn get_units(&self) -> Ev3Result<String>
fn get_units(&self) -> Ev3Result<String>
source§fn get_value(&self, index: u8) -> Ev3Result<i32>
fn get_value(&self, index: u8) -> Ev3Result<i32>
value{index} value if available.source§fn get_value0(&self) -> Ev3Result<i32>
fn get_value0(&self) -> Ev3Result<i32>
value0 value if available.source§fn get_value1(&self) -> Ev3Result<i32>
fn get_value1(&self) -> Ev3Result<i32>
value1 value if available.source§fn get_value2(&self) -> Ev3Result<i32>
fn get_value2(&self) -> Ev3Result<i32>
value2 value if available.source§fn get_value3(&self) -> Ev3Result<i32>
fn get_value3(&self) -> Ev3Result<i32>
value3 value if available.source§fn get_value4(&self) -> Ev3Result<i32>
fn get_value4(&self) -> Ev3Result<i32>
value4 value if available.source§fn get_value5(&self) -> Ev3Result<i32>
fn get_value5(&self) -> Ev3Result<i32>
value5 value if available.source§fn get_value6(&self) -> Ev3Result<i32>
fn get_value6(&self) -> Ev3Result<i32>
value6 value if available.source§fn get_value7(&self) -> Ev3Result<i32>
fn get_value7(&self) -> Ev3Result<i32>
value7 value if available.source§fn get_text_value(&self) -> Ev3Result<String>
fn get_text_value(&self) -> Ev3Result<String>
-EOPNOTSUPP if a sensor does not support text values.