Can't retrieve RPLidar A1M8 output onto Arduino

Hi everyone

I am trying to create an automation system using RPLidar as the sensor. I have made a program on C++ that reads the data sent onto USB port and it works just nice.

I then moved on to Arduino because I want the sensor data to control several GPIO pin outputs but I can't seem to get incoming data from the sensor.

I used the attached demo code simple_connect, like everyone else. I also connected the sensor Tx and Rx onto pins 19 and 20 to my Arduino Mega 2560 board because I know pins 0 and 1 will interfere with the communication between the board and my PC. However, I still cant get the sensor's data output.

Am i missing something here?

simple_connect.ino (3.37 KB)

I cant see where you defined the new pin connections you are using? 19 & 20?

hizkiaadrian:
Hi everyone

I am trying to create an automation system using RPLidar as the sensor. I have made a program on C++ that reads the data sent onto USB port and it works just nice.

I then moved on to Arduino because I want the sensor data to control several GPIO pin outputs but I can't seem to get incoming data from the sensor.

I used the attached demo code simple_connect, like everyone else. I also connected the sensor Tx and Rx onto pins 19 and 20 to my Arduino Mega 2560 board because I know pins 0 and 1 will interfere with the communication between the board and my PC. However, I still cant get the sensor's data output.

Am i missing something here?

from what I can see on the Mega, Serial1, Tx and Rx pins 18 and 19 respectively NOT 19 and 20!