EvoColorSensor#
- class EvoColorSensor(channel, i2c=I2CA, address=0x29)#
Driver for the Evo color sensor on an I2C multiplexer channel.
- setActive(enable=True)#
Enable or disable the color sensor.
- Returns:
None.
- isActive()#
Report the cached active state.
- Returns:
Boolean.
- active(value=None)#
Combined getter and setter for the active state.
- Returns:
Current active state when
valueisNone; otherwiseNoneafter updating the state.
- getSensorId()#
Read the sensor identification register.
- Returns:
Integer sensor ID.
- setIntegrationTime(ms)#
Set the RGBC integration time in milliseconds.
- Returns:
The integration time stored by the driver.
- getIntegrationTime()#
Read the cached integration time.
- Returns:
Integration time in milliseconds.
- setGain(gain)#
Set the closest supported gain for the sensor.
- Returns:
Selected gain value.
- getGain()#
Read the gain configured in the control register.
- Returns:
Gain value.
- getRawRed()#
- getRawGreen()#
- getRawBlue()#
- getRawClear()#
Read one raw color channel from the latest valid sample.
- Returns:
Raw integer channel value.
- getRawRGB()#
Read raw red, green and blue values.
- Returns:
(red, green, blue)tuple of integers.
- getRGB()#
Read normalized red, green and blue values.
- Returns:
(red, green, blue)tuple with values from0to255.
- getHSV()#
Convert the normalized RGB sample to HSV.
- Returns:
(hue, saturation, value)tuple.
- getThreshold()#
Read the interrupt threshold registers.
- Returns:
(cycles, min_value, max_value)tuple.
- setThreshold(cycles=None, min_value=None, max_value=None)#
Update interrupt threshold values. Unspecified values keep their current register setting.
- Returns:
None.
- interrupt(value=None)#
Get or set the color sensor interrupt enable bit.
- Returns:
Current interrupt state when
valueisNone; otherwiseNoneafter updating the setting.