Serial.print() prints separate chars instead of the whole string

I'm a newbie and do not know how Arduino serial port works.

I use two serial monitors.

I print "Hello". (Serial.print("Hello");

The Arduino serial monitor shows "Hello".

But the external monitor shows:

If I change the code to Serial.println("Hello"); to print the whole word then external monitor shows:
0d (next line character I suppose)

How can I make Arduino print "Hello" in one line, not separate characters?

Your other terminal that you failed to mention is bogus (or does not support UTF8 if you are sending 2 bytes data)… if you print a string, the characters are sent as they are….

I'm sorry. But if I send something to COM4 from the console application (.NET Core) everything is fine.


            var port = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);


But Arduino sends:

instead of "Hello".

This is a screenshot of the command sent from the application, not Arduino.

You forgot to tell us what this "external monitor" is.

This does not sound like an Arduino problem. For informed help, please read and follow the instructions in the how to use the forum post.

Sorry, but it is an Arduino problem.

I have two apps. One is the firmware of Arduino Uno, another one is the .NET Core app.

Both write to COM4 (not at the same time, of course).

.NET Core app shows "Hello" as expected.
Arduino shows: H e l l o (separate characters).

What command should I use to send a string, not separate chars for Arduino?

I'm using some program "Serial Port Monitor". You can see the screenshot above.


Sorry, but your post makes no sense, and fails to demonstrate that this is an "Arduino problem".

A program was uploaded to your Arduino via a serial port. That program runs. I'll leave it to you to figure out what that means.

show a complete compileable sketch only printing your hello.
show a screenshot of what you receive in your still unknown "monitor software" with exactly this sketch.
Use a different serial monitor. For example coolterm from [url][/url]

Post a link to the program, please. I'm not familiar with it but it seems to show what has been sent (IRP_MU_WRITE), not what was received.

I often use Realterm; it allows you to display the received values in HEX. CoolTerm might also have that option. That way you can exactly see what is received.

0d is part of the line-ending (it's the Carriage Return); Serial.println adds 0x0D (Carriage Return) as well as 0x0A (Line Feed).

I’ll chime in with the others. The Serial class will send the bytes just as they are and It’s by the very own serial nature that (bits of the) bytes are sent one after the other. It would make no sense to inject anything in between bytes.

Show the same screenshot when data is sent by Arduino.
Your monitor is NOT a usual serial Monitor like the one of the Arduino IDE. It is a debugging tool for serial lines.

Maybe someone will experience the same.

So, it is really not Arduino problem.

It's the problem of a device. Though it doesn't affect anything. So I blamed "separate" messages wrongfuly.

The problem is that PC is very fast. It can send a lot in a very short period of time. So in my "special COM monitor" these messages were shown as one ("Hello"). I sent "Hello" both from .NET Core app and Arduino monitor. All messages from PC were "Hello".

"Special COM monitor" is faster than ESP32 + usb/com cable. That's why ESP32 sent "H-e-l-l-o" instead of "Hello".

I thought that was the cause of device not responsiveness. I was wrong.

Sorry for wasting your time.

The right answer: to send raw data one should use "Serial.print()"

1 Like

Hmmm, not really.
You specify the serial bitrate.
The problem is most likely in the timeout/parsing/expectations of your code.

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