Hello,
I am trying to connect a Leddar M16 to my arduino Mega, it worked fine on my UNO using the code bellow.
I am using a linksprite RS485Shiled v2.1
/*
Simple Leddar(TM) Example - Without LCD
Language: Arduino
This program lists the detections read on the serial port of the Arduino.
Can be used with Arduino IDE's Serial Monitor.
Shields used:
- RS-485 Shield
Created 01 Jun. 2015
by Pier-Olivier Hamel
This example code is in the public domain.
*/
#include <Leddar.h>
Leddar16 Leddar1(115200,1);
//Baudrate = 115200
//Modbus slave ID = 01
void setup()
{
//Initialize Leddar
Leddar1.init();
}
void loop()
{
char result = Leddar1.getDetections();
if (result >= 0)
{
for (int i = 0; i < Leddar1.NbDet; i++)
{
Serial.print("Segment: ");
Serial.print(Leddar1.Detections*.Segment);*
- Serial.print(" Distance: ");*
_ Serial.print(Leddar1.Detections*.Distance);_
_ Serial.print("\n");_
_ } _
_ }_
_ else*_
* {*
* Serial.print("Error: ");*
* Serial.print((int)result);*
* Serial.print("\n");*
* }*
* delay(50);*
}
Do I need to change anything to the code? I keep getting error -2
Thx for the help!