Hello.
I try to count pedestrians using one of ToF sensors named LIDAR-Lite v3 with arduino.
Then, I want to measure the distance by them and move it alternately.
To realize this, I have to assign different address and I should command separately.
But now I need someone`s help.
Here is the code I wrote to change its address.
(This code is for one LIDAR-Lite connected to arduino UNO)
But, its address is still the default one(0x62).
What is wrong with my code?
I would appreciate if someone gives me a hand.
#include<Wire.h>
#define SET 0x00
#define ADDRESS 0x62
#define NEW_ADDRESS 0x63
#define READHIGH 0x16
#define READLOW 0x17
#define SERIALNUM 0x96
#define WRITEHIGH 0x18
#define WRITELOW 0x19
#define WRITEADD 0x1a
#define DISABLE 0x1e
int value1 = 0;
int value2 = 0;
void setup() {
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Wire.beginTransmission((int)ADDRESS);
Wire.write(SET);
Wire.endTransmission();
delay(20);
Wire.beginTransmission((int)ADDRESS);
Wire.write(SERIALNUM);
Wire.endTransmission();
delay(20);
Wire.requestFrom((int)ADDRESS, 2);
value1 = Wire.read();
value2 = Wire.read();
Wire.beginTransmission((int)ADDRESS);
Wire.write(WRITEHIGH);
Wire.write(value1);
Wire.endTransmission();
delay(20);
Wire.beginTransmission((int)ADDRESS);
Wire.write(WRITELOW);
Wire.write(value2);
Wire.endTransmission();
delay(20);
Wire.beginTransmission((int)ADDRESS);
Wire.write(WRITEADD);
Wire.write(NEW_ADDRESS);
Wire.endTransmission();
delay(20);
Wire.beginTransmission((int)ADDRESS);
Wire.write(DISABLE);
Wire.write(0x08);
Wire.endTransmission();
delay(20);
Thank you.