Giter VIP home page Giter VIP logo

adafruit_vl53l0x's Introduction

Adafruit VL53L0X Library Build StatusDocumentation

This is a library for the Adafruit VL53L0X time-of-flight breakout:

Check out the links above for our tutorials and wiring diagrams. This chip uses I2C to communicate

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution

adafruit_vl53l0x's People

Contributors

andrewiski avatar asukiaaa avatar brentru avatar caternuson avatar chetan-prime avatar deanm1278 avatar evaherrada avatar gergelytakacs avatar hoffmannjan avatar kurte avatar ladyada avatar paclema avatar paintyourdragon avatar rthille avatar servertech avatar siddacious avatar slav-at-attachix avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_vl53l0x's Issues

KeyWords

Would you please write a short description of included keywords in front of every keyword for ' Adafruit_VL53L0X/keywords.txt '

How to enable fractional measuring?

I see that the api has VL53L0X_SetRangeFractionEnable.

Has anyone got this enabled and working? Plz share the code!

It isn't enabled by default and so measure.RangeFractionalPart always returns 0.

Library does not work when external power source is used

Hi,

I know this sounds weird, but it really appears to be the case here.
I can connect other sensors just fine (the TSL2591 for example), on an external power source too, and it just works. Note: i want to use an external power source because feeding the i2c censors i have via just arduino is simply going to draw too much current.
When i swap the wires from the TSL2591 to the VL53L0X, it simply fails with:

Adafruit VL53L0X test
Failed to boot VL53L0X

And yes, if i use the arduino (micro) to power the chip, it works just fine. I do have a common ground.

You probably need more information so i enabled debugging:

void setup() {
  Serial.begin(115200);

  // wait until serial port opens for native USB devices
  while (! Serial) {
    delay(1);
  }
  
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin(0x29, true)) {
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  // power 
  Serial.println(F("VL53L0X API Simple Ranging example\n\n")); 
}

Note the:

if (!lox.begin(0x29, true)) {

With that enabled, it spits out:

Adafruit VL53L0X test
VL53L0X Info:
Device Name: VL53L0X TS1, Type: VL53L0X, ID: ␃Ap8␜␎␇␃Ap8␜␎␇␃A
Rev Major: 1, Minor: 1
VL53L0X: StaticInit
VL53L0X Error: -50
Failed to boot VL53L0X

The error (-50) means:

/*!< In the function a division by zero occurs */
#define VL53L0X_ERROR_REF_SPAD_INIT ((VL53L0X_Error) -50)

Which clearly points at a code issue... Somewhere...
When further investigating that error, i found this thread:
https://community.st.com/s/question/0D50X00009XkYOCSA3/spad-initialization-error

Which has a response (from just one month ago) from a ST employee with an apparent fix. I'm not quite sure if that is "the" fix for this issue, i haven't testes it yet.

Is there any more information that is required of me to fix this?

Best regards,
Mark

Long range mode

Hello,

I was just wondering how can I change the different modes of the sensor with this library.

Let me know,

Thanks

Incorrect header paths in \core\ and \platform\

Problem: If one attempts to use this library as a part of another Arduino library, the sketch will not compile.
Reason: The source files in the \core and \platform contain header includes that do not have a path included, they point to header files within the same directory.
Solution:

  1. Add "../../" to header includes in \core and \platform, or,
  2. consider changing the directory structure so that these source files are in the same directory with the headers.

High Speed Mode

Hello, is there a way to enable a high speed mode on the sensor? It may just be shortening the period it takes to read/process...?

Library unable to work on ESP32

Platform

ESP32: Adafruit HUZZAH32 – ESP32 Feather Board (Firmware Release 1.0.2)
VL53L0X: CJVL53L0XV2

Problem

After burning example code into ESP32, serial prompts the following content and the board keep rebooting.
After switching to the pololu library, the board works just fine

⸮)⸮�]⸮�!⸮⸮O�⸮�⸮k⸮⸮⸮⸮Յ⸮⸮!⸮Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception` was unhandled.
Core 1 register dump:
PC      : 0x400d5668  PS      : 0x00060130  A0      : 0x800d0f80  A1      : 0x3ffb1f10  
A2      : 0x3ffbdf10  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x00000017  
A6      : 0x00000000  A7      : 0x3ffbdf10  A8      : 0x800d5668  A9      : 0x3ffb1ee0  
A10     : 0x04c4b400  A11     : 0x00000016  A12     : 0x00000000  A13     : 0x00000064  
A14     : 0x00000000  A15     : 0x60013000  SAR     : 0x0000000a  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  

Backtrace: 0x400d5668:0x3ffb1f10 0x400d0f7d:0x3ffb1f30 0x400d48f6:0x3ffb1f50 0x400d0d81:0x3ffb1f80 0x400d6dab:0x3ffb1fb0 0x400877c1:0x3ffb1fd0

Rebooting...
⸮⸮⸮8�⸮
A�B⸮⸮⸮t��!y⸮⸮:S⸮⸮⸮ĥ⸮Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d5668  PS      : 0x00060130  A0      : 0x800d0f80  A1      : 0x3ffb1f10  
A2      : 0x3ffbdf10  A3      : 0x00000000  A4      : 0x00000001  A5      : 0x00000017  
A6      : 0x00000000  A7      : 0x3ffbdf10  A8      : 0x800d5668  A9      : 0x3ffb1ee0  
A10     : 0x04c4b400  A11     : 0x00000016  A12     : 0x00000000  A13     : 0x00000064  
A14     : 0x00000000  A15     : 0x60013000  SAR     : 0x0000000a  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  

Backtrace: 0x400d5668:0x3ffb1f10 0x400d0f7d:0x3ffb1f30 0x400d48f6:0x3ffb1f50 0x400d0d81:0x3ffb1f80 0x400d6dab:0x3ffb1fb0 0x400877c1:0x3ffb1fd0

Rebooting...`

IDE Output

In file included from .../Arduino/libraries/Adafruit_VL53L0X/src/vl53l0x_device.h:37:0,
                 from .../Arduino/libraries/Adafruit_VL53L0X/src/vl53l0x_def.h:90,
                 from .../Arduino/libraries/Adafruit_VL53L0X/src/platform/src/vl53l0x_i2c_comms.cpp:2:
.../Arduino/libraries/Adafruit_VL53L0X/src/vl53l0x_types.h:56:108: note: #pragma message: Please review  type definition of STDINT define for your platform and add to list above 
  #pragma message("Please review  type definition of STDINT define for your platform and add to list above ")

For esp 8266 only two sensors are initialized

  • Arduino board: ESP8266 NodeMCU Lolin (V3)

  • Arduino IDE version (found in Arduino -> About Arduino menu): Arduino IDE 2.0.3

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): In examples vl53l0x_dual and vl53l0x_multi_extended_test are initialized 2 sensors VL53L0x only
    I don't know how to initialize 3 sensors.
    Thanks.

Reference and crosstalk calibration routines givins strange results

Routine VL53L0X_perform_offset_calibration from src/core/src/vl53l0x_api_calibration.cpp is giving strange results. By my opinion the problem is in uint16_t sum_ranging which should be of type
uint32_t due to later bit shifting (<<16), which needs to be done due to fixed point arithmetics.
(I was performing this calibration at 270 mm distance, which is due to documentation not optimal one, but after the fixes it works fine).

In case of VL53L0X_perform_xtalk_calibration the same goes for multiple variables (sum_ranging, ...) that accumulate the range measurements performed by the routine. Unfortunately there are some other errors present due to which the calibration routine doesn't produce an appropriate XTalkCompensationRateMegaCps value. Due to the lack of understanding what this calibration routine is trying to compute, I am not able to figure it out why.
(I was performing this calibraton at 600 mm distance).

Not work with ESP32

Hello, i use this lib to read distance from VL53L0X. i use vl53l0x example to test but in serial monitor show

Adafruit VL53L0X test
Failed to boot VL53L0X

so i check communication between esp32 and VL53L0X via logic analyzer i found esp32 found 0x29 device address but in serial monitor show Failed to boot

How to fix this ?

Thanks !

Connecting Multiple Sensors

Hello,

I try to connect multiple sensors but it retourn me just one fixe value when I connect the second sensor... Do you have an idea ? Thanks

#include <Wire.h>
#include "Adafruit_VL53L0X.h"

#define SHUT_LOX 2
#define SHUT_LOX2 5

#define LOX_Adr 0x29
#define LOX2_Adr 0x30

Adafruit_VL53L0X lox = Adafruit_VL53L0X();
Adafruit_VL53L0X lox2 = Adafruit_VL53L0X();

void setup() {

// INIT SERIAL
Serial.begin(9600);
while (! Serial) {
delay(1);
}
Serial.println("Serial init ==> OK");

// INIT SENSORS DISTANCE
pinMode(SHUT_LOX,OUTPUT);
pinMode(SHUT_LOX2,OUTPUT);

delay(500);
Wire.begin();

Serial.println("Reset BOTH");
digitalWrite(SHUT_LOX,LOW);
digitalWrite(SHUT_LOX2,LOW);
delay(10); // Reset all sensors by setting all of their XSHUT pins low for delay(10), then set all XSHUT high to bring out of reset
digitalWrite(SHUT_LOX,HIGH);
digitalWrite(SHUT_LOX2,HIGH);
digitalWrite(SHUT_LOX,LOW);
digitalWrite(SHUT_LOX2,LOW);
Serial.println("Reset OK");

Serial.println("Init VL53L0X _ LOX");
//digitalWrite(SHUT_LOX2, LOW);
digitalWrite(SHUT_LOX, HIGH);
delay(10);

Serial.println("InitLOX.....");
lox.setAddress(LOX_Adr);
pinMode(SHUT_LOX, INPUT);
if (!lox.begin(LOX_Adr)) {
Serial.println(F("Failed to boot VL53L0X _ LOX"));
//while (1);
} else {
Serial.println(F(" ==> OK"));
}

delay(2000);

// init LOX2
Serial.println("InitLOX 2.....");
Serial.println("Init VL53L0X _ LOX2");
//digitalWrite(SHUT_LOX, LOW);
digitalWrite(SHUT_LOX2,HIGH);

delay(1);
lox2.setAddress(LOX2_Adr);
pinMode(SHUT_LOX2, INPUT);
if (!lox2.begin(LOX2_Adr)) {
Serial.println(F("Failed to boot VL53L0X _ LOX2"));
//while (1);
} else {
Serial.println(F(" ==> OK"));
}
//delay(1);

//digitalWrite(SHUT_LOX, HIGH);
// END INIT SENSORS

}

void loop() {

//capteur distance
VL53L0X_RangingMeasurementData_t measure;
lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!
Serial.println(measure.RangeMilliMeter);
Serial.print(" ");

}

Speed of the device

The example uses a delay at the end of loop of 100 ms. How much can this be shortened?

Where's the documentation?

I followed what claimed to be a link to documentation from this page and ended up at this repo. But I don't see any documentation here. Where is it?

Question: How to disable Informations?

Hello!
How may i disable all this Information when i just want the last value?

Writing 1 to addr 0x80: 0x1, Writing 1 to addr 0xFF: 0x1, Writing 1 to addr 0x0: 0x0, Writing 1 to addr 0x91: 0x3C, Writing 1 to addr 0x0: 0x1, Writing 1 to addr 0xFF: 0x0, Writing 1 to addr 0x80: 0x0, Writing 1 to addr 0x0: 0x1, Reading 1 from addr 0x0: 0x0, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x40, Reading 1 from addr 0x13: 0x44, Reading 12 from addr 0x14: 0x5B, 0x6, 0x4C, 0x4, 0x33, 0xE3, 0xA, 0xF9, 0x0, 0x12, 0x0, 0xA0, Writing 1 to addr 0xFF: 0x1, Reading 2 from addr 0xB6: 0x9, 0x58, Writing 1 to addr 0xFF: 0x0, Writing 1 to addr 0xB: 0x1, Writing 1 to addr 0xB: 0x0, Reading 1 from addr 0x13: 0x40, 160

My code looks like this:
lox.getSingleRangingMeasurement(&measure, false); Serial.println(measure.RangeMilliMeter);

Interrupt Example don't work

The interrupt example doesn't work. The interrupt is simply ignored. I.e. the distance is displayed although only the range of 50-100mm should be displayed.

Compilation errors for example codes in Arduino IDE

I tried to compile the sample code and got the following errors
Tried it with all 3 examples, all had similar issues.

11x 'error: stray '@' in program'
3x 'error: stray '\205' in program'
3x 'error: stray '\251' in program'
3x 'error: 'Skip' does not name a type'
2x 'error: 'TwoWire' does not name a type'
error: 'TwoWire' was not declared in this scope
8x error: 'TwoWire' has not been declared
error: 'i2c' was not declared in this scope
2x error: expected unqualified-id before numeric constant
error: 'Skip' does not name a type
error: 'Wire' was not declared in this scope
2x error: 'lox1' was not declared in this scope
error: call to 'boolean Adafruit_VL53L0X::begin(uint8_t, boolean, int*)' uses the default argument for parameter 3, which is not yet defined

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:0:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:39:1: error: stray '@' in program

@chetan-prime chetan-prime Add support for specifying an alternate I2C bus other than the hardco… 1563a9e on Sep 29, 2018

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:39:1: error: stray '\205' in program

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:40:1: error: stray '@' in program

@ladyada

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:41:1: error: stray '@' in program

@deanm1278

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:42:1: error: stray '@' in program

@ServerTech

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:43:1: error: stray '@' in program

@chetan-prime

^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:39:1: error: stray '@' in program

@chetan-prime chetan-prime Add support for specifying an alternate I2C bus other than the hardco… 1563a9e on Sep 29, 2018

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:39:1: error: stray '\205' in program

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:40:1: error: stray '@' in program

@ladyada

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:41:1: error: stray '@' in program

@chetan-prime

^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:284:5: error: stray '\251' in program

 © 2019 GitHub, Inc.

 ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:34:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:39:1: error: stray '@' in program

@chetan-prime chetan-prime Add support for specifying an alternate I2C bus other than the hardco… 1563a9e on Sep 29, 2018

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:39:1: error: stray '\205' in program

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:40:1: error: stray '@' in program

@ladyada

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:41:1: error: stray '@' in program

@chetan-prime

^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:284:5: error: stray '\251' in program

 © 2019 GitHub, Inc.

 ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:0:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:112:5: error: stray '\251' in program

 © 2019 GitHub, Inc.

 ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:0:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:2:1: error: 'Skip' does not name a type

Skip to content

^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:68:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:82:8: error: 'TwoWire' does not name a type

extern TwoWire Wire;

    ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:2:1: error: 'Skip' does not name a type

Skip to content

^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:75:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:5:22: error: 'TwoWire' was not declared in this scope

int VL53L0X_i2c_init(TwoWire *i2c);

                  ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:5:31: error: 'i2c' was not declared in this scope

int VL53L0X_i2c_init(TwoWire *i2c);

                           ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:6:95: error: 'TwoWire' has not been declared

int VL53L0X_write_multi(uint8_t deviceAddress, uint8_t index, uint8_t *pdata, uint32_t count, TwoWire *i2c);

                                                                                           ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:7:94: error: 'TwoWire' has not been declared

int VL53L0X_read_multi(uint8_t deviceAddress, uint8_t index, uint8_t *pdata, uint32_t count, TwoWire *i2c);

                                                                                          ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:8:76: error: 'TwoWire' has not been declared

int VL53L0X_write_byte(uint8_t deviceAddress, uint8_t index, uint8_t data, TwoWire *i2c);

                                                                        ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:9:77: error: 'TwoWire' has not been declared

int VL53L0X_write_word(uint8_t deviceAddress, uint8_t index, uint16_t data, TwoWire *i2c);

                                                                         ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:10:78: error: 'TwoWire' has not been declared

int VL53L0X_write_dword(uint8_t deviceAddress, uint8_t index, uint32_t data, TwoWire *i2c);

                                                                          ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:11:76: error: 'TwoWire' has not been declared

int VL53L0X_read_byte(uint8_t deviceAddress, uint8_t index, uint8_t *data, TwoWire *i2c);

                                                                        ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:12:77: error: 'TwoWire' has not been declared

int VL53L0X_read_word(uint8_t deviceAddress, uint8_t index, uint16_t *data, TwoWire *i2c);

                                                                         ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_i2c_platform.h:13:78: error: 'TwoWire' has not been declared

int VL53L0X_read_dword(uint8_t deviceAddress, uint8_t index, uint32_t *data, TwoWire *i2c);

                                                                          ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:106:5: error: 'TwoWire' does not name a type

 TwoWire   *i2c;

 ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api_strings.h:33:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:32,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:284:7: error: expected unqualified-id before numeric constant

 © 2019 GitHub, Inc.

   ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_api.h:34:0,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:69,

             from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/vl53l0x_platform.h:2:1: error: 'Skip' does not name a type

Skip to content

^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:0:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:81:85: error: 'TwoWire' has not been declared

 boolean       begin(uint8_t i2c_addr = VL53L0X_I2C_ADDR, boolean debug = false, TwoWire *i2c = &Wire);

                                                                                 ^

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:81:101: error: 'Wire' was not declared in this scope

 boolean       begin(uint8_t i2c_addr = VL53L0X_I2C_ADDR, boolean debug = false, TwoWire *i2c = &Wire);

                                                                                                 ^

In file included from [...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino:1:0:

[...]\Arduino\libraries\Adafruit_VL53L0X\src/Adafruit_VL53L0X.h:112:7: error: expected unqualified-id before numeric constant

 © 2019 GitHub, Inc.

   ^

[...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino: In function 'void setID()':

vl53l0x_dual:42: error: 'lox1' was not declared in this scope

if(!lox1.begin(LOX1_ADDRESS)) {

   ^

vl53l0x_dual:53: error: call to 'boolean Adafruit_VL53L0X::begin(uint8_t, boolean, int*)' uses the default argument for parameter 3, which is not yet defined

if(!lox2.begin(LOX2_ADDRESS)) {

                          ^

[...]\Arduino\libraries\Adafruit_VL53L0X\examples\vl53l0x_dual\vl53l0x_dual.ino: In function 'void read_dual_sensors()':

vl53l0x_dual:61: error: 'lox1' was not declared in this scope

lox1.rangingTest(&measure1, false); // pass in 'true' to get debug data printout!

^

exit status 1
'lox1' was not declared in this scope

Annoying Reading After Out of Range

I use example code and everything works fine, but when I put the sensor without a barrier or to get out of range, the output from Arduino Serial Monitoring sometime shows random numbers such as 2mm or 4mm. How to solve this, just make sure the result/output is always out of range not random numbers.

No timeout implemented in code

The TOF sensor is currently due to my lack of understanding, hanging in a loop where it does not work properly.
I enabled debug mode and 'fiddled' around with the sensor untill the error occured.

sVL53L0X: PerformSingleRangingMeasurement
Range Status: 8 : No Update
RANGE IGNORE THRESHOLD: 15.60
Measured distance: 1

Between the PerformSingleRangingMeasurment and Range Status pass +30 Seconds.

A timeout if that error occurs would be great!
Thank you.

Library sends errors on esp32s3

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: esp32-s3

  • Arduino IDE version (found in Arduino -> About Arduino menu): latest - Platformio

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

Steps to reproduce:

  • Use I2C multiplexer with with Adafruit_VL53L0X on esp32-s3.

This library calls begin() on the Twowire object, which is an issue when running the sensors on an I2C multiplexer, as the multiplexer needs to call begin() on the TwoWire object itself. This causes the I/O read timeout error to occur.

Need missing dox from PR #49

PR #49 was passing CI checks on its last commit. But after merging, CI is failing on missing dox. Not sure why that wasn't caught in the PR itself. Maybe the CI checks changed.

Anywho, need dox for:

/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:84: warning: Member startMeasurement(boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:85: warning: Member stopMeasurement(boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:86: warning: Member getLimitCheckCurrent(uint8_t LimitCheckId, FixPoint1616_t *pLimitCheckCurrent, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:89: warning: Member getDeviceMode(VL53L0X_DeviceModes *pDeviceMode, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:91: warning: Member setDeviceMode(VL53L0X_DeviceModes DeviceMode, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:94: warning: Member setInterruptThresholds(FixPoint1616_t ThresholdLow, FixPoint1616_t ThresholdHigh, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:97: warning: Member getInterruptThresholds(FixPoint1616_t *pThresholdLow, FixPoint1616_t *pThresholdHigh, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:100: warning: Member clearInterruptMask(boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:102: warning: Member getGpioConfig(VL53L0X_DeviceModes *pDeviceMode, VL53L0X_GpioFunctionality *pFunctionality, VL53L0X_InterruptPolarity *pPolarity, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.
/home/runner/work/Adafruit_VL53L0X/Adafruit_VL53L0X/src/Adafruit_VL53L0X.h:106: warning: Member setGpioConfig(VL53L0X_DeviceModes DeviceMode, VL53L0X_GpioFunctionality Functionality, VL53L0X_InterruptPolarity Polarity, boolean debug=false) (function) of class Adafruit_VL53L0X is not documented.

@Vgdn1942 Can you make a follow on PR with dox?

ESP32 Wippersnapper build - Warning - not initialised -Wmissing-field-initializers

There is a warning raised these days for not initialised things, and this has now bitten me when compiling this library into adafruit wippersnapper adafruit/Adafruit_Wippersnapper_Arduino#363 (comment)

The warning is:

 /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp: In function 'VL53L0X_Error VL53L0X_StaticInit(VL53L0X_DEV)':
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::HistogramMode' [-Wmissing-field-initializers]
     VL53L0X_DeviceParameters_t CurrentParameters = {0};
                                                      ^
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::MeasurementTimingBudgetMicroSeconds' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::InterMeasurementPeriodMilliSeconds' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::XTalkCompensationEnable' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::XTalkCompensationRangeMilliMeter' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::XTalkCompensationRateMegaCps' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::RangeOffsetMicroMeters' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::LimitChecksEnable' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::LimitChecksStatus' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::LimitChecksValue' [-Wmissing-field-initializers]
  /home/runner/Arduino/libraries/Adafruit_VL53L0X/src/core/src/vl53l0x_api.cpp:531:52: warning: missing initializer for member 'VL53L0X_DeviceParameters_t::WrapAroundCheckEnable' [-Wmissing-field-initializers]

pinging @brentru to stick on the backlog

Adafruit_VL53L0X.cpp file possible typo

In the file Adafruit_VL53L0X.cpp at line 100 it is written:

if( ( DeviceInfo.ProductRevisionMinor != 1 ) && ( DeviceInfo.ProductRevisionMinor != 1 ) )

I think this line should be:

if( ( DeviceInfo.ProductRevisionMajor != 1 ) && ( DeviceInfo.ProductRevisionMinor != 1 ) )

Schematic

How do I connect the VL53L0X to the Arduino? Which pins do I use for SCL and SDA? And do I have to connect Xshut and GPIO?
Thank you!

Problem with ESP32 S2

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2.10
    Library version 1.2.2
    Esp32 Runtime 2.0.9

Running on Generic ESP32 DEV Module this sketch
https://github.com/adafruit/Adafruit_VL53L0X/blob/master/examples/vl53l0x/vl53l0x.ino
Works fine using pins 21 and 22

On Esp32 S2 where i2c pins are 8 and 9 i get Failed to boot VL53L0X

I run a simple sketch to scan i2c connected and with both boards i get that there is a device connected at address 0x29 so is connected correctly.

Not getting by lox.begin()

Hey,

I followed the setup for the vl53l0x as shown in --> https://learn.adafruit.com/adafruit-vl53l0x-micro-lidar-distance-sensor-breakout/arduino-code, but the program is not running correctly.

  Serial.println("Adafruit VL53L0X test");
  Serial.println("this is a test");
  if (!lox.begin()) {
    Serial.println("this failed to boot");
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  Serial.println("I got through the boot stage");

When I open the serial window, I get "Adafruit VL53L0X test" and "this is a test", but I don't get anything after that. This makes me think that the program is not getting by lox.begin().

Any advice?
Cheers

Unable to compile when using USE_EMPTY_STRING

Expected behaviour
Building with USE_EMPTY_STRING defined reduces memory usage on memory constrained environments such as Arduino Nano.

Actual behaviour
Sketch fails to build due to several missing constants, eg: VL53L0X_STRING_ERROR_INTERRUPT_NOT_CLEARED

Environment
Tested on PlatformIO

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.