color
2.0.0.0
|
Color click is a color light sensing Click boardâ„¢, featuring the popular TSC3471 integrated color sensor. It is capable of sensing red, green, and blue light components, as well as the clear light.
We provide a library for the Color Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.
This library contains API for Color Click driver.
void color_cfg_setup ( color_cfg_t *cfg );
COLOR_RETVAL color_init ( color_t *ctx, color_cfg_t *cfg );
void color_default_cfg ( color_t *ctx );
float color_read_color_ratio ( color_t *ctx, uint8_t color );
float color_get_color_value ( color_t *ctx );
uint8_t color_get_color ( float color_value );
The following code demonstrates color detection/recognition functionality of the click.
The demo application is composed of two sections :
Initializes device and driver.
Checks which color is detected by the sensor. The name of the detected color is logged on the USBUART.
The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.
Other mikroE Libraries used in the example:
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.