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-04-17
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 3898 times
Not followed.
License: MIT license
Ambient 8 click is equipped with the ambient light sensor (ALS) IC, providing measurements of the ambient light intensity in a digital format. It utilizes the LTR-329ALS-01, an ALS with the I2C interface.
Do you want to subscribe in order to receive notifications regarding "Ambient 8 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Ambient 8 click" changes.
Do you want to report abuse regarding "Ambient 8 click".
Library Description
Library contains function for reading data from device registers Library contains function for writing data to device registers Libraty contains function for setting constants ( gain and integration time ) for Lux calculations Library contains function for device initialization Library contains function for reading ALS data ( channel 0 and channel 1 ) Library contains function for calculating Lux level based on ALS data from channels 0 and 1, window factor and IR factor.
Key functions:
void ambient8_setConstants( void )
- sets constants (gain and integration time) for lux level calculation.void ambient8_init( void )
- initializes the device, sets gain to 8X, sets integration time to 400ms.uint8_t ambient8_getLuxLevel( float * luxLevel_, float windowFactor_, float IRfactor_ )
- reads and data and performs lux level calculation.Examples description
The application is composed of the three sections :
void applicationTask( )
{
statusFlag = ambient8_getLuxLevel( &luxLevel, windowFactor, IRfactor );
if (statusFlag == 0)
{
mikrobus_logWrite( "lux Level : ", _LOG_TEXT );
FloatToStr( luxLevel, text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " lx", _LOG_LINE );
mikrobus_logWrite( " ", _LOG_LINE );
}
}
Other mikroE Libraries used in the example:
I2C
UART
Conversions
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.