I am trying to connect to YDLIDAR X4 with Processing serial library.
As the first step, I want to send system commands to X4, for example 0xA5 0x60 to being scan mode.
But X4 return nothing so far. X4 is definitely connecting on COM3. Thanks your help.
YDLIDAR manual
[https://www.ydlidar.com/Public/upload/files/2022-06-28/YDLIDAR%20X4%20Development%20Manual%20V1.6(211230).pdf](https://YDLIDAR manual)
import processing.serial.*;
Serial myPort; // Create object from Serial class
int val; // Data received from the serial port
void setup() {
size(200, 200);
myPort = new Serial(this, "COM3", 9600);
}
void draw(){
background(255);
if (val == 0) {
fill(0);
}
else {
fill(204);
}
rect(50, 50, 100, 100);
println(val);
}
void serialEvent(Serial myPort){
String myString = myPort.readString();
if(myString != null){
println(val);
}
println("getEvent!");
}
void mousePressed(){
myPort.write(char(0xA5));
myPort.write(char(0x60));
}