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
}
mirroring each other's measurements
mean?