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: 2020-07-14
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 2146 times
Not followed.
License: MIT license
Light mix-sens Click is carrying TMD37253, an advanced proximity measurement, color sense (RGBC+IR), and digital ambient light sensing (ALS) device. The TMD37253 slim module package has been designed to accommodate a “single hole†aperture approach that incorporates an IR LED and factory calibrated LED driver.
Do you want to subscribe in order to receive notifications regarding "Light mix-sens click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Light mix-sens click" changes.
Do you want to report abuse regarding "Light mix-sens click".
Library Description
This library allows user to perform a communication with the Light mix-sens Click board. The user can measure the full spectral of light together with proximity measurement. By switching an IR diode, one of two possible IR measurements can be executed, the level of IR light can be measured, or the proximity, together with the all other channels. For more details, please, check the full documentation.
Key functions:
lightmixsens_err_t lightmixsens_write_byte( uint8_t reg_addr, uint8_t data_in );
- This function writes data byte to the selected register.lightmixsens_err_t lightmixsens_read_byte( uint8_t reg_addr, uint8_t *data_out );
- This function reads data byte from the selected register.void lightmixsens_switch_ir_to_green( void );
- This function switches the IR light to be measured in the Green channel (GDATA) register.Examples description
The application is composed of three sections :
void application_task( )
{
lightmixsens_wait_atime( );
lightmixsens_read_word( LIGHTMIXSENS_REG_CDATA, &lightmixsens_cdata );
lightmixsens_read_word( LIGHTMIXSENS_REG_RDATA, &lightmixsens_rdata );
lightmixsens_read_word( LIGHTMIXSENS_REG_GDATA_IRDATA, &lightmixsens_gdata );
lightmixsens_read_word( LIGHTMIXSENS_REG_BDATA, &lightmixsens_bdata );
lightmixsens_read_byte( LIGHTMIXSENS_REG_PDATA, &lightmixsens_pdata );
WordToStr( lightmixsens_cdata, log_txt );
Ltrim( log_txt );
mikrobus_logWrite( "- Clear light: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
WordToStr( lightmixsens_rdata, log_txt );
Ltrim( log_txt );
mikrobus_logWrite( "- Red light: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
WordToStr( lightmixsens_gdata, log_txt );
Ltrim( log_txt );
mikrobus_logWrite( "- Green light: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
WordToStr( lightmixsens_bdata, log_txt );
Ltrim( log_txt );
mikrobus_logWrite( "- Blue light: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
prox_app( );
mikrobus_logWrite( "** Proximity: ", _LOG_TEXT );
mikrobus_logWrite( log_txt, _LOG_LINE );
mikrobus_logWrite( "", _LOG_LINE );
}
Additional Functions :
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.