Hello, i bought a laser module from china, i am trying to get it to work with arduino. It works with serial terminal on pc, but I cant get it to send replies and read from arduino. Can you please help? Thank you
UM-M8xx-JRT-kb-rev0 (1).pdf (1.79 MB)
arduino1.ino (707 Bytes)
first bit of help: read the bottom half of my signature line.
that thing looks very expensive; do you have a link to a retailer?
your code, in code tags:
//TX - RX3
//RX- TX3
//PWREN - D16
byte startmsg[] = {0x55};
byte shotmsg[] = {0xAA, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00, 0x21};
byte incomingByte;
void setup() {
pinMode(16, OUTPUT);
digitalWrite(16, HIGH);
Serial.begin(19200);
Serial3.begin(19200);
delay(100);
digitalWrite(16, LOW);
delay(100);
Serial3.write(startmsg, sizeof(startmsg));
delay(100);
}
void loop() {
Serial3.write(shotmsg, sizeof(shotmsg));
delay(1000);
for (int i = 0; i < 12; i++) {
while (!Serial3.available()); // wait for a character
int incomingByte = Serial3.read();
Serial.print(incomingByte, HEX);
Serial.print(' ');
}
}
I'm thinking your first problem is:
/
Serial.begin(19200);
Serial3.begin(19200);
}
that Serial.begin(19200) has to match the speed in the box at the bottom right of your serial monitor screen. it probably does not. you can adjust either, as long as they both match
bubbasiiini:
It works with serial terminal on pc, but I cant get it to send replies and read from arduino. Can you please help? Thank you
You need to explain that in a lot more detail, including diagrams showing how everything is connected in the working and non-working cases.
...R