I have a payment terminal which uses UART (or simply speaking Rx, Tx, Gnd pins) and I have an Android tablet app which is connected to the terminal using USB to DB9 adapter based on PL2303 chip. The Android app works well and it uses https://github.com/felHR85/UsbSerial to support serial communication. The protocol is very simple, basically Android sends strings like "REQINFO,4", "L2,xxx,xxx,*" etc. and recieves back a string statuses.
I'm trying to replace Android app with Arduino UNO, for which I naively assumed would be enough just to connect Tx,Rx of the terminal with Rx,Tx pins of the Arduino and also to connect Gnd pins. But I can't get it working. The only thing I noticed is when I connect Arduino Rx to terminal Tx, the terminal's screens briefly shows "Connecting..." but that's probably because it detects some incoming voltage. When it comes to reading Serial (or also I tried SoftwareSerial) nothing is ever returned.
String data = "";
void setup() {
Serial.begin(9600);
while (!Serial);
delay(1000);
Serial.println("REQINFO,4");
delay(1000);
}
void loop() {
if (Serial.available()) {
char c = Serial.read(); // also I tried readString() and readStringUntil()
if (c == '\n' || c == '\r') {
Serial.println(data); // jsut to see it in the montor
} else {
data += c;
}
}
}
So do I miss anyting in order to have a proper communication? Thanks.
