Squares in Serial Monitor

Can anybody help me out?

I'm getting squares in front of the output in the Serial Monitor.

  • I reinstalled the arduino IDE

  • I tried other USB Terminals

  • I tried different Baudrates

  • I tried floats and strings

Nothing changes. The Number of Squares is not always the same and if i change baudrate at some of them the square turnes into black questionmarks

Any Ideas?

sorry for the rusty english

1 Like

That sounds like a baud rate mismatch between the sketch and the Serial monitor settings or that you are printing non printable characters

What baud rate do you have the Serial monitor set to ?

1 Like

there is a screenshot in my post. I put 9600 in the serialmonitor and also Serial.begin(9600).

I figured out, that if i put a delay between Serial.begin and the Serial.println which is greater then 1099 ms it works well. but of course thats not what i want.

1 Like

Please don't post pictures of code

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

1 Like

What happens if you remove the delay(), upload the code, wait a couple of seconds then press reset on the Arduino ? This will not solve anything but may provide more evidence of what is happening

Please confirm that you are using and Arduino Mega board

if i remove delay(), upload the code (squares appear), and wait for a couple of seconds and press the reset button on the arduino, the squares dissapear

1 Like

i just wanted to show the serial output

Do you mean that the squares printed on booting up disappear or that they are still there but you also see the number 56 printed ?

Please post a screenshot showing what you see

first line in the serial monitor is from uploading
second line is the output after pressing the reset

Do you have anything connected to pins 0 or 1 of the Mega ?

nope

Then I am out of ideas

This is what i found in another forum, does it make sense?

"This happens to everyone, but it is normal.

It is the same serial port for programming and serial monitor and cannot be opened for both at the same time.

The IDE automatically closes the port for the serial monitor while programming the Arduino and reopens when it finishes. This 800 ms is the time your computer needs to reopen the port, meanwhile all data send by Arduino are lost (this not happens if you reset the Arduino).

In the Arduino Nano (not Every) when the serial monitor opens the port, a reset is sent to the Arduino, but this does not happens with Every."

It’s commonplace that the first line or two of printing is corrupted like that. I’ve found that a delay of 200 fixes it. Why would a brief pause in setup() - even a full second as in your example - trouble you?

During debugging, just ignore the squares.
With your final product, use a terminal program; I've tested cutecom and minicom (both under linux) and the problem does not show.

I can not tell you what the root cause is.

Notes:

  1. It's not related to upload. If you close serial monitor, disconnect the board, reconnect the board and start serial monitor again the same issue happens.
  2. I suspect that the 'squares' are leftovers from the bootloader. Getting rid of the bootloader (you will need a programmer to upload your code) will probably also get rid of them.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.