|
Hello, I am trying to get my Arduino to relay the serial data it receives. Here is the sketch that I have:
#include <NewSoftSerial.h> #define rxPin 2 #define txPin 3
byte incomingByte = 0;
NewSoftSerial nss(rxPin, txPin);
void setup() // run once, when the sketch starts { Serial.begin(19200); nss.begin(19200); }
void loop() // run over and over again {
// Read from the hardware UART. // If any data is available, write it out through the software serial
if (Serial.available() > 0) { incomingByte = Serial.read(); nss.print(incomingByte); } }
I have a simple windows app that is sending the following text strings repeatedly with a carriage return after each string. 1I5ED 2I5ED 3I5ED 4I5ED 5I5ED 6I5ED
Monitoring what the Arduino is sending out, the first 340 times it's fine then it starts to miss characters. See below. 1I5ED 2I5ED 3I5ED I5ED 5I5ED 6I5E 1I5ED 2I5ED 3IED 4I5ED 5I5ED I5ED
Is it a buffer problem? Does anyone have any ideas on how best I should do this?
|