Hi,
I'm trying to make a project with QRCode scanners and the manual of the barcode has the following indication:
Customers can periodically send heartbeat packets to ensure the data accuracy. The format is as
follows:
Heartbeat packets from main control
7E 00 0A 01 00 00 00 30 1A
Return command
03 00 00 01 00 33 31
Note: It is recommended to send a heartbeat packet every 10 seconds. If no correct reply is
received for three consecutive times, the main control should be handle
My question is how do I send the commend to the scanner and wait for a reply?
Code example:
#include <SoftwareSerial.h>
SoftwareSerial QRSerial(3, 4) //RX TX
String QRValue = "";
void setup() {
Serial.begin(9600);
QRSerial.begin(9600);
}
void loop() {
if (QRSerial.available()) {
QRValue += QRSerial.readString();
Serial.println(QRValue);
}
}
}
I can use the .available() to check if is there anything coming from the scanner but how do I send a command to it?