EvoRGBColorSensor#

class EvoRGBColorSensor#

Class to interact with the TCS34725 color sensor.

Initialisation & Setup

inline EvoRGBColorSensor::EvoRGBColorSensor(I2CChannel channel)#

Constructs an EvoTCS34725 object.

Parameters:

channel – The I2C channel to use.

bool EvoRGBColorSensor::begin()#

Initializes the TCS34725 sensor.

Returns:

True if the sensor was successfully initialized, false otherwise.

void EvoRGBColorSensor::setGain(tcs34725Gain_t gain)#

Sets the gain level for the sensor.

Gain Values are:

  • TCS34725_GAIN_1X

  • TCS34725_GAIN_4X

  • TCS34725_GAIN_16X

  • TCS34725_GAIN_60X

Parameters:

gain – Gain value from the tcs34725Gain_t enum. (Default is TCS34725_GAIN_16X).

void EvoRGBColorSensor::setIntegrationTime(uint8_t it)#

Sets the integration time for the sensor.

Parameters:

it – Integration time in milliseconds.

Get Raw Value Functions

uint16_t EvoRGBColorSensor::getRawRed()#

Retrieves the raw red sensor value.

Returns:

Raw red value.

uint16_t EvoRGBColorSensor::getRawGreen()#

Retrieves the raw green sensor value.

Returns:

Raw green value.

uint16_t EvoRGBColorSensor::getRawBlue()#

Retrieves the raw blue sensor value.

Returns:

Raw blue value.

uint16_t EvoRGBColorSensor::getRawClear()#

Retrieves the raw clear sensor value.

Returns:

Raw clear value.

Get Filtered Value Functions

float EvoRGBColorSensor::getRed()#

Retrieves the filtered red value.

Returns:

Filtered red value.

float EvoRGBColorSensor::getGreen()#

Retrieves the filtered green value.

Returns:

Filtered green value.

float EvoRGBColorSensor::getBlue()#

Retrieves the filtered blue value.

Returns:

Filtered blue value.

Get Multi-Value Functions

void EvoRGBColorSensor::getRawRGBC(uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c)#

Retrieves the raw RGBC (Red, Green, Blue, Clear) sensor values.

Parameters:
  • r – Pointer to store the raw red value.

  • g – Pointer to store the raw green value.

  • b – Pointer to store the raw blue value.

  • c – Pointer to store the raw clear value.

void EvoRGBColorSensor::getRGB(float *r, float *g, float *b)#

Retrieves the RGB color values as floating-point values.

Parameters:
  • r – Pointer to store the red value.

  • g – Pointer to store the green value.

  • b – Pointer to store the blue value.

void EvoRGBColorSensor::getHSV(float *h, float *s, float *v)#

Retrieves the HSV (Hue, Saturation, Value) color values.

Parameters:
  • h – Pointer to store the hue value (0-360).

  • s – Pointer to store the saturation value (0-100).

  • v – Pointer to store the value (0-100).