I need to interface a weighing scale. I want to receive and transmit. While I'm connecting to the sensor on hyper terminal, it shows a single line.

If I'm connecting the sensor on Arduino, the values are printed line by line, like this:


But I need a single line, like sensor:12.

While the sensor value changes, I need to print the same location line sensor:13.

Please help me.

  • Are you trying to say that you want a terminal display and that you want to update the value? – David Hoelzer Nov 21 '15 at 4:57
  • Have you tried ending each line with just a carriage return, "\r", instead of newline, "\n" ? Or you can print the \r at the beginning of each line. – James Waldby - jwpat7 Nov 21 '15 at 5:05
  • yes.....@David Hoelzer bro....... – Ilayaraja Raja Nov 21 '15 at 6:03
  • yes..........@David Hoelzer bro – Ilayaraja Raja Nov 21 '15 at 6:04

So what you want to do is to output the data without the newline character. So instead of using something like:


in your code use:


That will cause each reading to be output on the same line, starting from the left hand most position. If there is a chance that the readings will be of different lengths you might want to output something like:

"sensor:%d \r"

The spaces at the end will make sure that you don't have extraneous characters if, for example, your reading went from 100 to 99.

| improve this answer | |

This looks ok using screen on linux, should work on HyperTerminal too

#include <string.h>
int i, n ;
char *aux = (char*) calloc(3, sizeof(char));

void setup() {
  // put your setup code here, to run once:

void loop() {
  // put your main code here, to run repeatedly:

  Serial.print("Sensor: ");
  for(i = 50; i >= 0; i--)  {
    sprintf(aux, "%2d", i);
| improve this answer | |

Actually you are receiving different lines in both hyper terminal and Arduino.

It displays so due to the settings in the software. It is actually overwriting the previous line displayed with new line.

I didnt see any way to 'overwrite' the previous content displayed in arduino serial monitor.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.