We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2019-06-05
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 4167 times
Not followed.
License: MIT license
Color 3 click is a mikroBUS add-on board with a TCS3771 color sensor (also known as a light-to-digital converter) and a narrow beam Infrared LED. The circuit can also function as a proximity sensor.
TCS3771 is a RGBC sensor: it can detect Red, Green, Blue and clear light. The IC performs well under a variety of lighting conditions.
Do you want to subscribe in order to receive notifications regarding "Color 3 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Color 3 click" changes.
Do you want to report abuse regarding "Color 3 click".
Library Description
The library covers all the necessary functions that enables the usage of the Color 3 Click board. It offers a choice of writing(in normal and special mode) and reading one byte or two bytes of data in and from registers. The library includes a functions for reading clear, red, green, blue (separately or all together) and proximity values. User can, also use functions to apply or check many different settings including, but not limited to: LED drive strength, diode selection, RGBC Gain Value, Set long wait... It is also possible to check the state of INT pin.
Key functions:
uint16_t color3_readRedData()
- Read red data function.uint16_t color3_readGreenData()
- Read green data function. uint16_t color3_readBlueData()
- Read blue data function.Examples description
The application is composed of the three sections :
void applicationTask() { clearData = color3_readClearData(); WordToStr( clearData, logTxt ); ltrim( logTxt ); mikrobus_logWrite( " Clear: ", _LOG_TEXT ); mikrobus_logWrite( logTxt, _LOG_LINE ); redData = color3_readRedData(); WordToStr( redData, logTxt ); ltrim( logTxt ); mikrobus_logWrite( " Red: ", _LOG_TEXT ); mikrobus_logWrite( logTxt, _LOG_LINE ); greenData = color3_readGreenData(); WordToStr( greenData, logTxt ); ltrim( logTxt ); mikrobus_logWrite( " Green: ", _LOG_TEXT ); mikrobus_logWrite( logTxt, _LOG_LINE ); blueData = color3_readBlueData(); WordToStr( blueData, logTxt ); ltrim( logTxt ); mikrobus_logWrite( " Blue: ", _LOG_TEXT ); mikrobus_logWrite( logTxt, _LOG_LINE ); mikrobus_logWrite( "-----------------", _LOG_LINE ); Delay_ms( 1000 ); }
Other mikroE Libraries used in the example:
I2C
UART
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.