TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137052 times)
  2. FAT32 Library (70178 times)
  3. Network Ethernet Library (56055 times)
  4. USB Device Library (46374 times)
  5. Network WiFi Library (41992 times)
  6. FT800 Library (41328 times)
  7. GSM click (29083 times)
  8. mikroSDK (26522 times)
  9. PID Library (26466 times)
  10. microSD click (25449 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

LightRanger 4 click

Rating:

5

Author: MIKROE

Last Updated: 2018-09-30

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 4474 times

Not followed.

License: MIT license  

Light Ranger 4 click is an accurate distance measurement Click boardâ„¢ based on a ToF (Time of Flight) measurement principle. The FlightSense enabled VL53L1X rangefinder module from STMicroelectronics is a complete measurement stack on the chip.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LightRanger 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LightRanger 4 click" changes.

Do you want to report abuse regarding "LightRanger 4 click".

  • mikroSDK Library 2.0.0.0
  • Comments (1)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

LightRanger 4 click

LightRanger 4 click

Native view of the LightRanger 4 click board.

View full image
LightRanger 4 click

LightRanger 4 click

Front and back view of the LightRanger 4 click board

View full image

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 Configuration chip, sets measurement distance mode, inter measurement period, timing budget and user Roi. The user has the functions available for softReset, power on procedure, read distance of the object in front of the sensor

Key functions:

  • uint8_t lightranger4_deviceConfiguration() - Functions for device configuration
  • void lightranger4_startMeasurement(uint32_t period_ms) - Functions for start measurement
  • uint16_t lightranger4_getDistance() - Function reads distance of the object in front of the sensor

Example description

The application is composed of three sections:

  • System Initialization - Initializes I2C module and set INT pin as INPUT and RST pin as OUTPUT
  • Application Initialization - Initializes the driver init, chip configuration, adjusts the LONG mode (distance measurement up to 4 meters), sets the time budget and start measurement with the adjustment of inter measurements period.
  • Application Task - (code snippet) - Reads the distance of the object in front of the sensor and logs distance to USBUART every 500 ms.
void applicationTask()
{
 while(lightranger4_newDataReady() != 0)
 {
 Delay_1ms();
 }

 distance = lightranger4_getDistance();
 IntToStr(distance, demoText);
 mikrobus_logWrite(" - Distance : ", _LOG_TEXT);
 mikrobus_logWrite(demoText, _LOG_TEXT);
 mikrobus_logWrite(" mm ", _LOG_LINE);

 measurementStatus = lightranger4_getRangeStatus();
 switch (measurementStatus)
 {
 case _LR4_MRESP_SIGNAL_FAIL:
 {
 mikrobus_logWrite( "Signal fail.", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_PHASE_OUT_OF_VALID_LIMITS:
 {
 mikrobus_logWrite( "Phase out of valid limits", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_SIGMA_FAIL:
 {
 mikrobus_logWrite( "Sigma Fail. ", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_WRAP_TARGET_FAIL:
 {
 mikrobus_logWrite( "Wrap target fail.", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_MINIMUM_DETECTION_THRESHOLD:
 {
 mikrobus_logWrite( "Target is below minimum detection threshold. ", _LOG_LINE);
 break;
 }
 default:
 {
 break;
 }
 }

 Delay_ms( 500 );
}


Other mikroE Libraries used in the example:

  • I2C

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

CAP Slider 2 click

5

CAP Slider 2 click is a capacitive touch sensor with XY cross shaped electrodes integrated on a Click board.

[Learn More]

Secure 5 click

0

Secure 5 Click carries the ATECC508A cryptographic coprocessor with secure hardware-based key storage, from Microchip. The ATECC508A includes an EEPROM array which can be used for storage of up to 16 keys, certificates, miscellaneous read/write, read-only or secret data, consumption logging, and security configurations.

[Learn More]

Charger 19 click

0

Charger 19 Click is a compact add-on board that contains a battery charger. This board features the nPM1100, an integrated power management IC from Nordic Semiconductor. It has a highly efficient DC/DC buck regulator with automatic selection between hysteretic and PWM modes.

[Learn More]