Testing my program by connecting two Arduino`s together via serial, Tx - Rx
Program starts with no connection and waits for data, serial is connected, data is read, but a string of -1 is added to it.
If disconnect the serial connection, serial is still read, but with all -ones.
I would have thought that with no data input, the program would wait?
Here`s part of receive test code
void loop() {
if (Serial.available() > 0 ) {
while (inByte != 0xFF)
{
inByte = Serial.read();
counter++;
Serial.print(inByte);
Serial.print("");
}
Serial.println("");
Serial.println("");
Serial.print("Counter is ");
Serial.println(counter);
Serial.println("Run-in Ended");
Serial.println("");
counter = 0;
inByte = Serial.read();
} //SerialEnd
} //LoopEnd
Output on Serial Monitor
10-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1858585858585858585858585858585858585858585858585858585858585255
Counter is 60
Run-in Ended
Thanks.