Hi, i just bought an VL53L0X and i am trying to see how it works but i just can't seem to make it work.
I have already downloaded the library just like the tutorials say but all i get is Failed to boot VL53L0X.
I am using an Arduino Nano and these are my connections:
#include "Adafruit_VL53L0X.h"
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
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()) {
Serial.println(F("Failed to boot VL53L0X"));
while(1);
}
// power
Serial.println(F("VL53L0X API Simple Ranging example\n\n"));
}
void loop() {
VL53L0X_RangingMeasurementData_t measure;
Serial.print("Reading a measurement... ");
lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!
if (measure.RangeStatus != 4) { // phase failures have incorrect data
Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
} else {
Serial.println(" out of range ");
}
delay(100);
}
Find and run the I2C scanner sketch. Is the device connected correctly? If the I2C scanner doesn't find it, or hangs, it is not. If it does, what is its address?
Hi, Thank you for your response.
Yesterday i did the scanner and i wanted it to do it again but i found with another problem!!
I cant upload skeches to my arduino, this is what i get
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
I tried change the arduino, i select correctly the port and the board and still the same, i reinstalled the arduino IDE also
No. It means that the hardware is working, and that the device was recognized, at address 0x29.
Now, you should re-run the original sketch, making sure that the sketch/library are expecting the device to have that address. IIRC, that is the default address, so you shouldn't need to do anything.
The next step, if the original sketch still fails to begin() the device would be to add some Serial.print() statements to the library, to determine why begin() fails.