Beginner here, need help with a loop.

What I want to do is for the serial monitor to accept a line i typed, then spit it out with that line + a fullstop(.).

Example. If i type in "Hello", it should return "Hello." and the next time i type something, let's say "welcome", this appears on a new line as "welcome."

I'm having some problems with this as I don't know how to proceed.

This is the basic codes that I have with me right now.
It would be much appreciated if someone could help me.

void setup()

void loop(){

char myString[20];
int index = 0;

while (Serial.available() > 0) {

myString[index] =;


Start with Robin2's serial input basics tutorial.

A key point is how you mark the end of your input.

Please remember to use code tags when posting code.

How will your code know what is the end of the line?

If you set up serial monitor to send a newline, you can detect that. Next you can replace the newline character with a dot.

Further suggested reading for when you get further into communication: serial input basics