MatrixMiniR4 1.1.5
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MatrixColor Class Reference

Class for interacting with a color sensor. More...

#include <MiniR4ColorSensorExt.h>

Public Member Functions

bool begin ()
 Initializes the color sensor.
 
void setGamma (bool state)
 Sets the gamma correction state for the sensor.
 
void setLight (bool state, bool mode, uint8_t pwm)
 Sets the light state and mode for the sensor.
 
uint8_t getColor (ColorType color)
 Gets the value of a specific color from the sensor.
 
uint8_t getGrayscale ()
 Gets the grayscale value from the sensor.
 
uint8_t getColorNumber ()
 Gets the number of colors supported by the sensor. Number of color as follow as below: 0:Black, 1:White, 2:Cyan, 3:Ocean, 4:Blue, 5:Violet, 6:Magenta 7:Raspberry, 8:Red, 9:Orange, 10:Yellow, 11:Spring, 12:Green, 13:Turquoise.
 

Public Attributes

uint8_t _ch = 0
 
TwoWire * _pWire
 

Detailed Description

Class for interacting with a color sensor.

This class provides methods to initialize the sensor, configure settings, and retrieve color values from the sensor.

Definition at line 36 of file MiniR4ColorSensorExt.h.

Member Function Documentation

◆ begin()

bool MatrixColor::begin ( )

Initializes the color sensor.

Returns
true if initialization was successful, false otherwise.

Definition at line 8 of file MiniR4ColorSensorExt.cpp.

◆ getColor()

uint8_t MatrixColor::getColor ( ColorType color)

Gets the value of a specific color from the sensor.

Parameters
colorThe color type to retrieve.
Returns
The value of the specified color.

Definition at line 53 of file MiniR4ColorSensorExt.cpp.

◆ getColorNumber()

uint8_t MatrixColor::getColorNumber ( )

Gets the number of colors supported by the sensor. Number of color as follow as below: 0:Black, 1:White, 2:Cyan, 3:Ocean, 4:Blue, 5:Violet, 6:Magenta 7:Raspberry, 8:Red, 9:Orange, 10:Yellow, 11:Spring, 12:Green, 13:Turquoise.

Returns
The number of color values.

Definition at line 65 of file MiniR4ColorSensorExt.cpp.

◆ getGrayscale()

uint8_t MatrixColor::getGrayscale ( )

Gets the grayscale value from the sensor.

Returns
The grayscale value.

Definition at line 60 of file MiniR4ColorSensorExt.cpp.

◆ setGamma()

void MatrixColor::setGamma ( bool state)

Sets the gamma correction state for the sensor.

Parameters
statetrue to enable gamma correction, false to disable it.

Definition at line 23 of file MiniR4ColorSensorExt.cpp.

◆ setLight()

void MatrixColor::setLight ( bool state,
bool mode,
uint8_t pwm )

Sets the light state and mode for the sensor.

Parameters
statetrue to turn on the light, false to turn it off.
modeThe mode of the light (e.g., PWM).
pwmThe PWM value to set the light brightness.

Definition at line 34 of file MiniR4ColorSensorExt.cpp.

Member Data Documentation

◆ _ch

uint8_t MatrixColor::_ch = 0

Definition at line 61 of file MiniR4ColorSensorExt.h.

◆ _pWire

TwoWire* MatrixColor::_pWire

Definition at line 62 of file MiniR4ColorSensorExt.h.


The documentation for this class was generated from the following files: