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-01-30
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 3715 times
Not followed.
License: MIT license
Ambient 5 click can sense the intensity of the ambient light, providing measurement data in a digital format, over the I2C interface. It utilizes the VEML6030, a miniature ambient light sensor (ALS) which occupies only 2x2 mm of space.
Do you want to subscribe in order to receive notifications regarding "Ambient 5 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Ambient 5 click" changes.
Do you want to report abuse regarding "Ambient 5 click".
Library contains functions for reading from and writing to selected registers Library contains functions for calculating refresh time, data resolution and light level Library contains functions for powering device on and checking state of int pin Library contains functions for setting high and low threshold values.
Key functions:
void ambient5_powerOn( void )
- Fpowers device on and sets basic settings.float ambient5_getHighResolutionLightLevel( void )
- returns ambient light level in lux [lx].uint16_t ambient5_getRefreshTime( void )
- returns time needed for new data to become available.Examples description
The application is composed of the three sections :
void applicationTask( )
{
for (i = 0; i < rTime; i ++)
{
Delay_ms(1);
}
highResLightLevel = ambient5_getHighResolutionLightLevel( );
FloatToStr( highResLightLevel, text );
mikrobus_logWrite( " Ambient Light Level : ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " lx", _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 clickor 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.