Struct ev3dev_lang_rust::sensors::ColorSensor[][src]

pub struct ColorSensor { /* fields omitted */ }
Expand description

LEGO EV3 color sensor.

Implementations

Try to get a Self on the given port. Returns None if port is not used or another device is connected.

Try to find a Self. Only returns a motor if their is exactly one connected, Error::NotFound otherwise.

Extract list of connected ‘Self’

Reflected light - sets LED color to red

Reflected light - sets LED color to red

Reflected light - sets LED color to red

Ambient light - sets LED color to blue (dimly lit)

Ambient light - sets LED color to blue (dimly lit)

Ambient light - sets LED color to blue (dimly lit)

Color - sets LED color to white (all LEDs rapidly cycling)

Color - sets LED color to white (all LEDs rapidly cycling)

Color - sets LED color to white (all LEDs rapidly cycling)

Raw Reflected - sets LED color to red

Raw Reflected - sets LED color to red

Raw Reflected - sets LED color to red

Raw Color Components - sets LED color to white (all LEDs rapidly cycling)

Raw Color Components - sets LED color to white (all LEDs rapidly cycling)

Raw Color Components - sets LED color to white (all LEDs rapidly cycling)

Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous

Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous

Calibration ??? - sets LED color to red, flashing every 4 seconds, then goes continuous

Get the color value for the modes COL-REFLECT, COL-AMBIENT, COL-COLOR and REF-RAW.

Red component of the detected color, in the range 0-1020.

Green component of the detected color, in the range 0-1020.

Blue component of the detected color, in the range 0-1020.

Red, green and blue componets of the detected color, each in the range 0-1020

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the attribute wrapper for an attribute name.

Returns the name of the port that the motor is connected to.

Sends a command to the device controller.

Returns a space separated list of commands that are supported by the device controller.

Returns the name of the driver that provides this device.

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. Read more

Returns the format of the values in bin_data for the current mode. Possible values are:

Returns the number of decimal places for the values in the value<N> attributes of the current mode.

Returns the firmware version of the sensor if available. Currently only NXT/I2C sensors support this. Read more

Returns the current mode. See the individual sensor documentation for a description of the modes available for each type of sensor. Read more

Sets the sensor to that mode. See the individual sensor documentation for a description of the modes available for each type of sensor. Read more

Returns a list of the valid modes for the sensor.

Returns the number of value<N> attributes that will return a valid value for the current mode.

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. Read more

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. Read more

Returns the units of the measured value for the current mode. May return empty string if units are unknown.

Returns the current value{index} value if available.

Returns the current value0 value if available.

Returns the current value1 value if available.

Returns the current value2 value if available.

Returns the current value3 value if available.

Returns the current value4 value if available.

Returns the current value5 value if available.

Returns the current value6 value if available.

Returns the current value7 value if available.

Returns a space delimited string representing sensor-specific text values. Returns -EOPNOTSUPP if a sensor does not support text values.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.