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-07-25
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Optical
Downloaded: 4031 times
Not followed.
License: MIT license
Light Ranger 3 click is an accurate distance measurement Click board based on a ToF (Time of Flight) measurement principle.
Do you want to subscribe in order to receive notifications regarding "LightRanger 3 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "LightRanger 3 click" changes.
Do you want to report abuse regarding "LightRanger 3 click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in registers and reading data from registers. The library includes functions for full initialization chip with the procedure is written following the instructions from the datasheet. The user has the functions available for softReset, read distance and confidence distance value, Then functions for go to standby mode, go to off mode, go to on mode and measurement mode.
Key functions:
uint8_t lightranger3_init()
- Functions for initializes chipuint8_t lightranger3_takeSingleMeasurement()
- Functions for measurementuint16_t lightranger3_getDistance()
- Functions for reads distanceExample description
The application is composed of three sections:
void applicationTask()
{
lightranger3_takeSingleMeasurement();
Distance = lightranger3_getDistance();
IntToStr(Distance,DistanceTxt);
mikrobus_logWrite( "Distance =", _LOG_TEXT );
mikrobus_logWrite( DistanceTxt, _LOG_TEXT );
mikrobus_logWrite( " mm", _LOG_LINE );
Delay_ms( 300 );
}
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.