Hello,
I am currently trying to use an Arduino Pro Mini to communicate with an LWNV7 laser range finding module. I learned all of this stuff a while ago and I am having issues spinning my knowledge back up to where it once was.
I have been able to test the module to ensure that it works with a gui provided by the manufacturer.
I have the module being powered by a benchtop power supply (3.3V) with a shared ground to arduino board because the usb cannot seem to provide enough current.
I am just trying to get first contact with the module through arduino and feel that if I can get any response from it I have the ability to parse the inbound data and respond. Any ideas what I might be doing wrong here?
I have attempted to attach the communication protocol document but being a new user I am not allowed, so here are some snippets:
-Data packet format: (8 data bits, 1 stop bit, no parity, default rate 9600)
-Beginning of packet 1: fixed as AE
-Beginning of packet 2: fixed as A7
-For single range: Send command:AE A7 04 00 05 09 BC BE
-reply to range command: AE A7 17 00 85 MMSG* BC BE
I cannot seem to get any indication that the device is getting the command or responding with data on the serial monitor.
#include <SoftwareSerial.h>
#define rxPin 10 //yellow
#define txPin 11 //green
// Set up a new SoftwareSerial object
int analogValue;
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
void setup() {
// Define pin modes for TX and RX
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// Set the baud rate for the SoftwareSerial object
mySerial.begin(9600);
}
void loop() {
byte getRange[] = {0xAE, 0xA7, 0x04, 0x00, 0x05, 0x09, 0xBC, 0xBE};
mySerial.write(getRange,sizeof(getRange));
while (mySerial.available() > 0) {
static char message[20];
static unsigned int messagePos = 0;
char inByte = mySerial.read();
if(inByte != '\n')
{
message[messagePos] = inByte;
messagePos++;
mySerial.print(message);
}
}
}```
Thank you in advance for any help on this!