13 if (i2cReadData(Device_ID) == 0x43) {
14 i2cWriteData(Device_CONFIG, 0x10);
16 i2cWriteData(Device_CONFIG, setting);
27 setting |= 0b00000100;
29 setting &= 0b00001011;
31 i2cWriteData(Device_CONFIG, setting);
39 setting |= 0b00000010;
41 setting &= 0b00001101;
44 setting |= 0b00000001;
46 setting &= 0b00001110;
48 i2cWriteData(Device_CONFIG, setting);
49 i2cWriteData(Device_LIGHT, pwm);
56 return i2cReadData(ColorRegType(color));
62 return i2cReadData(Device_GRAY);
68 return i2cReadData(Device_NUM_COLOR);
71uint8_t MatrixColor::i2cReadData(ColorRegType reg)
76 _pWire->endTransmission(1);
87void MatrixColor::i2cMUXSelect()
92 _pWire->endTransmission(1);
93 delayMicroseconds(300);
96void MatrixColor::i2cWriteData(ColorRegType reg, uint8_t data)
104 _pWire->endTransmission(1);
Matric Color Sensor functions.
enum __ColorType ColorType
uint8_t getColorNumber()
Gets the number of colors supported by the sensor. Number of color as follow as below: 0:Black,...
bool begin()
Initializes the color sensor.
uint8_t getGrayscale()
Gets the grayscale value from the sensor.
uint8_t getColor(ColorType color)
Gets the value of a specific color from the sensor.
void setLight(bool state, bool mode, uint8_t pwm)
Sets the light state and mode for the sensor.
void setGamma(bool state)
Sets the gamma correction state for the sensor.