fran_3
1
I'm running 2.1.1 on Win10 Pro with a Uno R3 connected via USB.
The code and the Serial Monitor are set to 9600 baud.
When I compile and upload the Serial Monitor displays some garbage...
Then displays the proper out put.
Here is the output...
(note first line is actually a bunch of boxes with H, another box and j at the end)
�H�j
3
ode End
Start Now
5
1.00
1
6
4
Code End
Here is the Code...
void setup() {
Serial.begin(9600);
Serial.println ("\nStart Now");
Serial.println(constrain(5,1,6));
Serial.println(sin(1.57));
randomSeed(analogRead(0));
for(int i = 0; i < 3; i++){
Serial.println(random(1,10));
}
Serial.println("Code End\n");
}
void loop() {
}
The more code I add the more garbage is sent to the Serial Monitor before the expected output appears on the monitor.
Thanks for any help.
Try adding Serial.flush(); as the last command in setup() to force the output of whatever is in the Serial buffer before moving on
You might also consider using a faster baud rate such as 115200
Hi @fran_3. The Arduino IDE developers are tracking this bug here:
If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject.
system
Closed
4
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.