Struct ev3dev_lang_rust::sensors::LightSensor[][src]

pub struct LightSensor { /* fields omitted */ }

LEGO EV3 light sensor.

Implementations

impl LightSensor[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_REFLECT: &'static str[src]

Reflected light. LED on

pub fn set_mode_reflect(&self) -> Ev3Result<()>[src]

Reflected light. LED on

pub fn is_mode_reflect(&self) -> Ev3Result<bool>[src]

Reflected light. LED on

pub const MODE_AMBIENT: &'static str[src]

Ambient light. LED off

pub fn set_mode_ambient(&self) -> Ev3Result<()>[src]

Ambient light. LED off

pub fn is_mode_ambient(&self) -> Ev3Result<bool>[src]

Ambient light. LED off

pub fn get_light_intensity(&self) -> Ev3Result<i32>[src]

A measurement of the light intensity, unscaled.

pub fn get_reflected_light_intensity(&self) -> Ev3Result<f32>[src]

A measurement of the reflected light intensity, as a percentage.

pub fn get_ambient_light_intensity(&self) -> Ev3Result<f32>[src]

A measurement of the ambient light intensity, as a percentage.

Trait Implementations

impl Clone for LightSensor[src]

impl Debug for LightSensor[src]

impl Device for LightSensor[src]

impl Sensor for LightSensor[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.