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-09-01
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 1875 times
Not followed.
License: MIT license
Ambient 9 Click is a compact add-on board that contains an integrated ambient light sensing and proximity detector with IR LED in an optical module.
Do you want to subscribe in order to receive notifications regarding "Ambient 9 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Ambient 9 click" changes.
Do you want to report abuse regarding "Ambient 9 click".
Library Description
Library provides functions for basic reading and writing to device. There are some specific functions for enabling sesnors and reading data from previous enabled sensor.
Key functions:
void ambient9_enable_data ( uint8_t als_ps )
- Enable one of sensorsuint32_t ambient9_als_data ( void )
- Read ALS datauint16_t ambient9_proxy_data ( void )
- Read proximity dataExamples description
The application is composed of three sections :
void application_task ( )
{
uint16_t proxy_data;
uint32_t als_data;
if ( AMBIENT9_ALS == dev_mode )
{
als_data = ambient9_als_data( );
LongWordToStr( als_data, demo_txt );
mikrobus_logWrite( " - ALS data: ", _LOG_TEXT );
mikrobus_logWrite( demo_txt, _LOG_LINE );
}
else if ( AMBIENT9_PROXY == dev_mode )
{
proxy_data = ambient9_proxy_data( );
WordToStr( proxy_data, demo_txt );
mikrobus_logWrite( " - Proximity data: ", _LOG_TEXT );
mikrobus_logWrite( demo_txt, _LOG_LINE );
}
Delay_ms( 100 );
}
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.