color11 2.2.0
Loading...
Searching...
No Matches
color11


Color 11 Click

Color 11 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Nenad Filipovic
  • Date : Sep 2023.
  • Type : I2C type

Software Support

Example Description

This library contains API for the Color 11 Click driver. The demo application sets sensor configuration and reads and displays ALS data measurement results.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Color11

Example Key Functions

Application Init

Initialization of I2C module and log UART. After the driver init, the app executes a default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
color11_cfg_t color11_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
color11_cfg_setup( &color11_cfg );
COLOR11_MAP_MIKROBUS( color11_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == color11_init( &color11, &color11_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( COLOR11_ERROR == color11_default_cfg ( &color11 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, " ------------------\r\n" );
Delay_ms ( 100 );
}
@ COLOR11_ERROR
Definition color11.h:290
#define COLOR11_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition color11.h:215
void application_init(void)
Definition main.c:32

Application Task

This example demonstrates the use of the Color 11 Click board™. Reads and displays the results of the ALS data measurements. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
uint8_t status = 0;
if ( COLOR11_OK == color11_get_data_valid_status( &color11, &status ) )
{
color11_als_data_t color_data;
if ( COLOR11_OK == color11_get_als_data( &color11, &color_data ) && ( COLOR11_STATUS2_AVALID & status ) )
{
log_printf( &logger, " Clear: %u\r\n", color_data.clear );
log_printf( &logger, " Red : %u\r\n", color_data.red );
log_printf( &logger, " Green : %u\r\n", color_data.green );
log_printf( &logger, " Blue : %u\r\n", color_data.blue );
log_printf( &logger, " Wideband : %u\r\n", color_data.wideband );
log_printf( &logger, " Flicker : %u\r\n", color_data.flicker );
log_printf( &logger, " ------------------\r\n" );
Delay_ms ( 1000 );
}
}
}
@ COLOR11_OK
Definition color11.h:289
#define COLOR11_STATUS2_AVALID
Color 11 valid status bit mask.
Definition color11.h:167
void application_task(void)
Definition main.c:70
uint16_t clear
Definition color11.h:262
uint16_t wideband
Definition color11.h:266
uint16_t blue
Definition color11.h:265
uint16_t green
Definition color11.h:264
uint16_t flicker
Definition color11.h:267
uint16_t red
Definition color11.h:263

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.