Error of RPLIDAR A1 simple connect

I am currently using the Arduino code "Simple_connect" provided by RPLIDAR A1. However, there is a problem with this code.

First, it fails to output all angles, resulting in an error such as a yellow highlight in the middle.

The second problem is that the angles are not output sequentially, but are mixed up in the middle.

I lack the ability to analyze the code. I would appreciate it if you point out the problem.

Thank you.[/color]

simple_connect.ino (3.37 KB)

That code is crap. It is using the only hardware serial port to talk to the PC and the lidar instance. That is just never going to work.

You either need to use an Arduino with multiple hardware serial ports, such as the Mega, or use software serial to talk to the lidar, which is going to be a problem if you need to use a baud rate of 115200 to talk to that device.

Are you saying that you can change to Arduino Mega? I already ran it with Arduino Mega and got the same error.

Sorry. I have already connected the sensor with arduino board with your advise. Thank you