![]() |
MatrixMiniR4 1.1.9
Matrix Mini R4 Arduino Library API Documentation
|
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_Deprecated () |
| (Deprecated) 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 | |
| float | getH () |
| Getting Hue value (色相) from color sensor. | |
| float | getS () |
| Getting Saturation value (飽和度) from color sensor. | |
| float | getV () |
| Getting Value/Brightness (明度) from color sensor. | |
| int8_t | getColorID () |
| Get Color ID for easy color recognition. | |
| void | RGB2HSV (uint8_t r, uint8_t g, uint8_t b, float &h, float &s, float &v) |
| A method to convert RGB to HSV. | |
Public Attributes | |
| uint8_t | _ch = 0 |
| TwoWire * | _pWire |
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 47 of file MiniR4ColorSensorExt.h.
| bool MatrixColor::begin | ( | ) |
Initializes the color sensor.
Definition at line 8 of file MiniR4ColorSensorExt.cpp.
| uint8_t MatrixColor::getColor | ( | ColorType | color | ) |
Gets the value of a specific color from the sensor.
| color | The color type to retrieve. |
Definition at line 53 of file MiniR4ColorSensorExt.cpp.
| int8_t MatrixColor::getColorID | ( | ) |
Get Color ID for easy color recognition.
Definition at line 131 of file MiniR4ColorSensorExt.cpp.
| uint8_t MatrixColor::getColorNumber_Deprecated | ( | ) |
(Deprecated) 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
Definition at line 65 of file MiniR4ColorSensorExt.cpp.
| uint8_t MatrixColor::getGrayscale | ( | ) |
Gets the grayscale value from the sensor.
Definition at line 60 of file MiniR4ColorSensorExt.cpp.
| float MatrixColor::getH | ( | ) |
Getting Hue value (色相) from color sensor.
Definition at line 116 of file MiniR4ColorSensorExt.cpp.
| float MatrixColor::getS | ( | ) |
Getting Saturation value (飽和度) from color sensor.
Definition at line 121 of file MiniR4ColorSensorExt.cpp.
| float MatrixColor::getV | ( | ) |
Getting Value/Brightness (明度) from color sensor.
Definition at line 126 of file MiniR4ColorSensorExt.cpp.
| void MatrixColor::RGB2HSV | ( | uint8_t | r, |
| uint8_t | g, | ||
| uint8_t | b, | ||
| float & | h, | ||
| float & | s, | ||
| float & | v ) |
A method to convert RGB to HSV.
| r | Red value (0-255) |
| g | Green value (0-255) |
| b | Blue value (0-255) |
| h | Hue output (0-360 degrees) |
| s | Saturation output (0-100%) |
| v | Value output (0-100%) |
Definition at line 71 of file MiniR4ColorSensorExt.cpp.
| void MatrixColor::setGamma | ( | bool | state | ) |
Sets the gamma correction state for the sensor.
| state | true to enable gamma correction, false to disable it. |
Definition at line 23 of file MiniR4ColorSensorExt.cpp.
| void MatrixColor::setLight | ( | bool | state, |
| bool | mode, | ||
| uint8_t | pwm ) |
Sets the light state and mode for the sensor.
| state | true to turn on the light, false to turn it off. |
| mode | The mode of the light (e.g., PWM). |
| pwm | The PWM value to set the light brightness. |
Definition at line 34 of file MiniR4ColorSensorExt.cpp.
| uint8_t MatrixColor::_ch = 0 |
Definition at line 80 of file MiniR4ColorSensorExt.h.
| TwoWire* MatrixColor::_pWire |
Definition at line 81 of file MiniR4ColorSensorExt.h.