Serial.print prints twice

Hello guys, I'm new to Arduino and I wanted to do some examples to get familiar with syntax and I'm getting this boring problem;

My code simply creates char array(name), fills it with user input and displays it with Serial.print;

void setup() {

char name[6];
int i=0;
void loop() {



Serial.println("Received value=");


For example when I entered character 'B' output is ;

Received value=
BReceived value=

What is the Line ending set to in the Serial monitor ?

Caution - name[6] only has elements 0::5

UKHeliBob new line

lastchangename yeah, it should be char name[5]

Guys I take this double writing problem wherever I use, I have searched in forum and some people gets this problem too. I know code has no logical errors, even I copy pasted one code in forum and same result.

Maybe some hardware problems cause this ?

When you have the line ending menu set to newline, it sends the data you entered (B in this case), followed by a newline character. Do you see the problem now?

The possible solutions:

  • Set the line ending menu to "No line ending".
  • Change your code so it works as you want it to with any line ending characters.

UKHeliBob new line

There is the problem as pert has pointed out

UKHeliBob, pert "no line ending" solved my problem, thank you !