Reference
Last revision 2026/01/15
RGB Color Sensor vs AS7341 Sensor
| Yellow LED | WS2812 Simulated Yellow | |
|---|---|---|
| Recognition result of RGB color sensor | Red+Green | Red+Green |
| Recognition result of AS7341 visible light sensor | Yellow | Red+Green |
You can click here find information about what visible light is.

Library
Download and install the AS7341 library and Sample Code. (About how to install the library?)
Communication Protocol Description
- I2C Address: 0x39
API Description
/**
* @brief Set gain value (0~10 corresponds to X0.5,X1,X2,X4,X8,X16,X32,X64,X128,X256,X512)
* @param The value of register CFG1
*/
void setAGAIN(uint8_t value);
/**
* @brief Read the value of sensor data channel 0~5, under eF1F4ClearNIR
* @return The data of sModeOneData_t
*/
sModeOneData_t readSpectralDataOne();
/**
* @brief Read the value of sensor data channel 0~5, under eF5F8ClearNIR
* @return The data of sModeTwoData_t
*/
sModeTwoData_t readSpectralDataTwo();
/**
* @brief Read the value of register flicker, through which the flicker frequency of the light source can be predicted
* @return The data of register flicker
*/
uint8_t readFlickerData();
/**
* @brief Turn the LED on or off
* @param true or false
*/
void enableLed(bool on);
/**
* @brief Set pin current to control brightness (1~20 corresponds to current 4mA,6mA,8mA,10mA,12mA,......,42mA)
* @param 1~20
*/
void controlLed(uint8_t current);
Other Supplementary Information
Was this article helpful?
