Go Down

Topic: Delay() is 5 times too long (Read 774 times) previous topic - next topic


If sending 1 byte causes receiving 4 bytes of crap + 1 repliable byte, and it's really related to baud rate, one of my guesses were you don't modify the sender's baud rate ?

What if you only do the delay, if you intend to reply,
or you reply always ( e.g. some error msg in case of unexpected input ),
or you simply skip that if (input1 < 128 ) check ? 

Nick Gammon

Rework without the delay between each byte, eg.

Code: [Select]

const int ledPin = 13;
byte input1;

void setup()

void loop()
  while (Serial.available())    // while data is received
    input1 = Serial.read();
    if (input1 < 128)   // just a check that I don't receive random crap
      Serial.write(input1);   // send the data back to check

// short delay *here* if you absolutely must


Go Up