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-08-09
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Proximity
Downloaded: 3753 times
Not followed.
License: MIT license
Proximity 11 Click is a close-range proximity sensing Click board, equipped with the RPR-0521RS, a very accurate and power-efficient proximity and ambient Light Sensor with IrLED. It allows an accurate proximity detection for a maximum distance of 100mm.
Do you want to subscribe in order to receive notifications regarding "Proximity 11 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Proximity 11 click" changes.
Do you want to report abuse regarding "Proximity 11 click".
Library Description
Library contains function for returnning INT pin state Library contains functions for getting and setting device register content Library contains function for updating data used to calculate ALS Lux value Library contains function for device initialization Library contains function for raw data to Lux converison Library contains functions for getting PS and ALS values Library contains functions for getting raw PS and ALS data Library contains functions for setting ALS and PS High and Low thresholds Library contains function for setting PS offset value
Key functions:
void proximity11_update(void)
- updates data used to calculate Luxuint8_t proximity11_init(void)
- initializes the devicevoid proximity11_getPsAlsValues( uint16_t * ps_value, float * als_value )
- gets raw ALS and PS data and converts raw ALS data to Lux valueExamples description
The application is composed of three sections :
void applicationTask( )
{
proximity11_getPsAlsValues( &ps_value, &als_value );
WordToStr( ps_value, text );
mikrobus_logWrite( "PS : ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " [count]", _LOG_LINE );
FloatToStr( als_value, text );
mikrobus_logWrite( "ALS : ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " [Lx]", _LOG_LINE );
mikrobus_logWrite( " ", _LOG_LINE );
Delay_ms(500);
}
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.