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: 2018-04-18
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 4985 times
Not followed.
License: MIT license
UV 4 click is a powerful Ultra Violet (UV) sensing device and Ambient Light Sensor (ALS) Click board, featuring a sensor with a very wide dynamic range of detectable light intensity, across two ADC range settings.
Do you want to subscribe in order to receive notifications regarding "UV 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "UV 4 click" changes.
Do you want to report abuse regarding "UV 4 click".
Library Description
Initializes and defines I2C driver and driver functions which offer a choice of writing in registers and reading from the registers. The library also has the ability for light measurements. The library can measure Small, Medium, and Large IR light, White and Large White light and UV and Deep UV light, whose values can be 16-bit or 24-bit. The library also offers a choice between channels that the user wants to measure desired light. For more details check the documentation.
Key functions:
UV4_RETVAL_T uv4_writeReg( const uint8_t reg_address, const uint8_t transfer_data ) - The function writes one-byte data in the register.
UV4_RETVAL_T uv4_readReg( const uint8_t reg_address, uint8_t *dataOut, const uint8_t inc_en, const uint8_t nBytes ) - The function reads a determined number of bytes from the register or repeats reading from one same register.
UV4_RETVAL_T uv4_writeParamData( uint8_t param_address, uint8_t transfer_data ) - The function writes one-byte data in the parameter table.
void uv4_readMeasurements( uint32_t *measureOut ) - The function reads measured determined data from selected channel/channels when the measurement is completed on a selected channel.
Examples Description
void applicationTask() { uv4_readMeasurements( &data_[ 0 ] ); for (i = 0; i < 6; i++) { if (configByte & pom) { if (opticalData[ i ] == _UV4_OPT_FUNC_SMALL_IR) mikrobus_logWrite( "Small IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_MEDIUM_IR) mikrobus_logWrite( "Medium IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_LARGE_IR) mikrobus_logWrite( "Large IR: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_WHITE) mikrobus_logWrite( "White: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_LARGE_WHITE) mikrobus_logWrite( "Large White: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_UV) mikrobus_logWrite( "UV: ", _LOG_TEXT ); else if (opticalData[ i ] == _UV4_OPT_FUNC_UV_DEEP) mikrobus_logWrite( "UV-Deep: ", _LOG_TEXT ); LongWordToStr( data_[ i ], text ); mikrobus_logWrite( text, _LOG_LINE ); } pom <<= 1; } mikrobus_logWrite( "", _LOG_LINE ); pom = 1; Delay_ms( 500 ); }
Other mikroE Libraries used in the example:
Additional notes and information
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.