serial display

I just want to print some numbers in the same place on the serial screen as the program runs but the numbers keep scrolling either upwards or to the left. The screen should read direction=13 windspeed=12 but it should always be in the same place on the screen , what am I doing wrong???

(deleted)

It is hard to say without seeing your code, but you are probably doing

Serial.println(...) ;

where you should be doing

Serial.print(...) ;
#define BACKSPACE 8
for (int i=0 ; i<=25 ; i++) 
{
  Serial.write(BACKSPACE) ;
}

You will want to modify this if direction or windspeed could be more or fewer digits.

To post code and/or error messages:

  1. Use CTRL-T in the Arduino IDE to autoformat your complete code.
  2. Paste the complete autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.
  3. Paste the complete error message between code tags (the </> button)
    so that we can easily see and deal with your messages.
  4. If you already posted without code tags, you may add the code tags by
    editing your post. Do not change your existing posts in any other way.
    You may make additional posts as needed.

Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.

If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a clear photograph of the wiring.

Good Luck!

Even better might be

Serial.print(...) ;
#define RETURN 13
Serial.write(RETURN) ;

Thanks very much for your help, I am kind of an amateur floundering around here but I have had some success which keeps me going.
I tried what you said but I just get a line of 25 little squares and the line scrolls off the screen horizontally as before. Seems like it doesnt recognize the BACKSPACE instruction ??.
Also someone said I need a better serial monitor??, how do I get one of those??

here is the code

void setup() {

#define BACKSPACE 8
Serial.begin(9600);
}

void loop() {

Serial.print(“hello”) ;

for (int i=0 ; i<=25 ; i++)
{
Serial.write(BACKSPACE) ;
}
}

Do you use a decent terminal program or do you use serial monitor. You don't mention an OS, but you can consider RealTerm or putty for windows, use minicom under Linux and no idea what is available for Mac.

Serial monitor is just primitive from a terminal perspective; the only advantage it has is that it works in cooperation with the IDE and does not interfere with uploads of code.

I am still struggling with just printing some variables to the screen in the same place every loop of the program. I want it to write wind speed and direction in the same place on the serial monitor instead of scrolling off either vertically of horizontally. Just not getting it??

void setup() {
int windspeed=34;

Serial.begin(115200);
}

void loop() {

Serial.print("wind speed = ") ;Serial.print(wind speed ) ;
#define BACKSPACE 8
for (int i=0 ; i<=25 ; i++)
{
Serial.write(BACKSPACE) ;
}

}

Just not getting it??

Correct. You are just not getting it. The Serial Monitor does NOT know how to print a backspace.

Use a real terminal application that understands ANSI control codes or write your own app. Trying to make the Serial Monitor app act as a GUI is pointless.

what on earth is a real terminal application and where do I get one. Someone on THIS forum told me to use the backspace character and now you are telling me the Serial monitor cant do this??

Someone on THIS forum told me to use the backspace character and now you are telling me the Serial monitor cant do this??

You tried it. Something happened. That you posted after trying it suggests that it did not do what you want. What other conclusions are we to draw?

Real terminal applications include RealTerm, Putty, etc.