Arduino Code Example
Below is a simple Arduino example for reading serial data from the laser distance sensor.
#include <SoftwareSerial.h>
SoftwareSerial laserSerial(10, 11); // RX, TX
void setup() { Serial.begin(9600); laserSerial.begin(9600);
Serial.println("Laser Distance Sensor Ready");
}
void loop() { while (laserSerial.available()) { char c = laserSerial.read(); Serial.write(c); }
}
Mayer Xiao