I just unpackaged & plugged in my new Uno.
As a test, I followed this example Arduino Tutorial - Lesson 4 - Serial communication and playing with data, which simply sends "Hello, World" out the (USB) serial port upon reset.
However, when I use the Serrial Monitor to view this output, I get garbage (see attached screenshot).
This example is so dead-simple, what could possibly have gone wrong?
void setup() // run once, when the sketch starts
{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Hello world!"); // prints hello with ending line break
}
void loop() // run over and over again
{
// do nothing!
}
Funny how posting to a forum causes you to find the solution.
I was poking around the Arduino IDE and, just for grins, selected Tools > Fix Encoding & Reload.
And now the serial monitor shows the expected string.
I'm blown away. Have been struggling to figure out why I get 2 funny characters on startup. Your post about the Tools->Fix encoding and reload actually worked. Problem solved. Why? Can anybody explain?
I think "fix encoding" correcting the error might be a consequence of bogus non-printing characters at the start of the string you're printing?
the_confusedcious:
initialize for baud rate of 9600,
and in serial monitor view for 9600*2 times baud rate.
hope it helps
If using different baud rate in sketch and serial monitor is needed, your board definition's speed and the actual speed the board is running at are different - in your case, likely you've got 8MHz board selected for a 16MHz board (the only one where this will happen with "standard" boards whilest still being able to upload, at least within standard AVR boards, would be thinking you have 8MHz pro mini, when you actually have a 16MHz one (it's pretty common to get the wrong one when you order pro mini's from china).
Suspect if you used delay (say, just uploading blink) you'd find that the timing was also off by the same factor.