getSurreal / XV_Lidar_Controller

Arduino code for controlling the Neato XV Lidar
Apache License 2.0
130 stars 46 forks source link

Can it work on mega2560? #6

Closed StreakingJerry closed 3 years ago

StreakingJerry commented 4 years ago

Hi, I tried to run it on mega2560 by modifing all the defined(AVR_ATmega32U4) to defined(AVR_ATmega2560). The compling looks good but once I open the serial monitor, the Arduino IDE just be no response. I think the only difference in this case is Mega2560 need a USB chip but Mega32u4 can Connect usb directly. But I don't think it is matter in this code. Could you please help me with that?

getSurreal commented 4 years ago

It should work with a mega with some pin adjustments. You need to make sure that the serial1 pins (18&19) are used to communicate to the lidar. Ensure the pwm motor pin you select is a part of timer3 (2,3,5).

StreakingJerry commented 4 years ago

Hi, the only thing I modified are three board selection parts. I tested it on mega2560 but still the same problem. I used an arduino uno with LidarSpoofing and connect the TX on arduino uno to RX1 on mega2560. with baudrate 115200 the serial monitor will stop within about 5 seconds. Could you please test it? Thank you. XV_Lidar_Controller.zip LidarSpoofing.zip

getSurreal commented 4 years ago

Sorry, I can't help you with testing that. The code has a built-in shutdown if it does not receive the Neato Lidar data within 5 seconds. Your lidar spoofing would have to be sending the same protocol as the Neato Lidars.

StreakingJerry commented 4 years ago

Yes I noticed that. with spoofing given by Cheng-Lung Lee I haven't seen any automatic "motoroff" shutdown in the serial monitor. Anyway thank you for your information.