I'm using the code below, but I had no success.
I'm using this connection wire: The photo of the Arduino doesn't show the SCL and SDA pins, but please consider that it has 2 SCL pins and 2 SDA pins in the places where I marked them in the image.
Both sensors are working, however they are mirroring each other's measurements.
That link is from the datasheet: https://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf
#include <Wire.h>
#include <LIDARLite.h>
#define LIDAR1_ADDRESS 0x62 // Endereço I2C do LIDAR Lite 1
#define LIDAR2_ADDRESS 0x63 // Endereço I2C do LIDAR Lite 2
LIDARLite lidar1; // Objeto para o LIDAR Lite 1
LIDARLite lidar2; // Objeto para o LIDAR Lite 2
void setup() {
Wire.begin(); // Inicializa a biblioteca Wire (I2C)
Serial.begin(115200); // Inicializa a comunicação serial
// Inicializa os objetos dos LIDARs
lidar1.begin(LIDAR1_ADDRESS); // Inicialização do LIDAR Lite 1
lidar2.begin(LIDAR2_ADDRESS); // Inicialização do LIDAR Lite 2
}
void loop() {
int distance1 = lidar1.distance();
int distance2 = lidar2.distance();
// Exibe as medições dos LIDARs no Monitor Serial
Serial.print("LIDAR 1: ");
Serial.print(distance1);
Serial.print(" cm | LIDAR 2: ");
Serial.print(distance2);
Serial.println(" cm");
delay(500); // Intervalo entre as leituras
}
1 Answer 1
If these are the Garmin Lidar Lite V3, here is a link to their data sheet. On page 5 of the datasheet you'll find instructions for configuring their I2C addresses. If you haven't already done that, it's quite likely that both devices are replying at once to the same query.
If you have done that already, please update your question with that and any other relevant data - such as the manufacturer, if I got that wrong, add any configuration changes you've made.
mirroring each other's measurements
mean?