Yes. That makes sense. How should the Slave know how much and when data is arriving?
I wrote a listener as soon as a Serial.available() is true
void loop() {
// unsigned int incoming = rs485.scan(data);
// if(incoming>0) {
// Logger::log(data,incoming);
// }
// delay(5);
if(Serial.available()) {
while(true) {
byte r = Serial.read();
if(r==120 || r==49 || r==50) {
Serial.println(r);
}
}
}
delay(1000);
}
The while loop is constantly scanning the serial line. There should not be a timing issue, since I am constantly listening. Here also only '120' is detected.
Removing the if and constantly reading results in the output
120 // for the send character(s)
-1
-1
-1
...
120
-1
-1
...
but never '49' or '50'.
Shouldnt at least sometimes the other characters appear?