arduino/ArduinoCore-sam

Unexpected extra characters appeared in the IDE Serial Monitor when write to Serial in loop()

Ebola-Chan-bot opened this issue · 0 comments

void setup() {
  Serial.begin(9600);
  Serial.setTimeout(65535);
}
void loop() {
  Serial.println("Snapshot");
  char C;
  Serial.readBytes(&C,1);
}

Upload this sketch in Arduino IDE and open the Serial Monitor. There is a certain probability that unexpected random characters will be generated before normal output.
image
This is not likely an IDE problem because the same code uploaded to Mega2560 does not have this problem.