Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:46:31+00:00 2026-06-18T12:46:31+00:00

First of all, sorry for the confusing title. I’m trying to make a simple

  • 0

First of all, sorry for the confusing title. I’m trying to make a simple program on my arduino that echos the serial input received from the serial monitor. My code is this:

String string= "";
String string2 = "";

void setup()
{
    Serial.begin(9600);

}

void loop() {


    string = "";

    while(Serial.available() > 0)
    {
        string += (char) Serial.read();
        Serial.flush();

    }


    if(string != "")
    {
        Serial.println(string); 
    }

}

But when I upload it and open the serial monitor, and input anything it is spread over several lines, as so:

Input: Why are you doing this?

W
hy 
are y
ou doin
g this?

I’ve been stuck on this for hours now. My device is the Arduino Uno (Offical), I’m running on windows 7. Thanks in advance for any help.

Edit: Serial.print(string) returns nothing, leaves the console screen blank.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:46:33+00:00Added an answer on June 18, 2026 at 12:46 pm

    Use Serial.print(string); instead of println()

    println() Prints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or ‘\r’) and a newline character (ASCII 10, or ‘\n’).

    Ref: http://arduino.cc/en/Serial/Println

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all, sorry if the title is a bit confusing. i'm planning to
First of all sorry for the confusing thread title. I couldn't come up with
First of all sorry for my pour english. I'm trying to make virtual world
First of all sorry for my bad english! Anyway I'm trying to make a
First of all sorry for the name of the title, but i dont know
First of all, sorry for my English... I'm developing an iOS application that has
first of all, sorry if that question is dumb but I´m a total newbie
First of all Sorry if my question title sounds stupid.... I have the following
first of all, sorry for the non descriptive title, I'm just too rushed so
First of all: Sorry for my bad English! I know the title isn't the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.