6

I'm testing out an accelerometer and I want to know if there's a way to make it so that the serial monitor will update the values without printing a new line. Ideally the serial monitor would say something like:

Accelerometer X: $xval
Accelerometer y: $yval

and then instead of printing two new lines each time, it just updates the values. Is there anyway to do that in Arduino? Thanks.

Hammad
  • 61
  • 1
  • 3
  • What happens if you make the serial monitor 20 lines long. And then print your 2 lines + 18 lines? I'm not sure, but it might fake a 'value update' – aaa Apr 17 '15 at 12:41

3 Answers3

6

The ultra-basic "serial monitor" in the Arduino IDE cannot do what you want.

Instead you need to either write a special client program, or use a more standard serial terminal program, such as Tera Term (Windows), Minicom (Linux), etc.

These standard serial terminal programs use a special sequence of characters called ANSI escape codes which manipulate the display, doing such things as setting colours, moving the cursor around, etc.

More information on ANSI escape codes can be found here: http://en.wikipedia.org/wiki/ANSI_escape_code

Majenko
  • 105,095
  • 5
  • 79
  • 137
3

No. The serial monitor does not support terminal handling. Either use a serial communications program that does and use those features, or write a custom client that will only update those values in its interface.

Ignacio Vazquez-Abrams
  • 17,663
  • 1
  • 27
  • 32
1

You might want to look into processing. You can use that to view the accelerometers position in 3d and see the values changing if that's what you want. The official Arduino site talks about it here. Here is a great tutorial on it.

NULL
  • 810
  • 1
  • 9
  • 20
  • I would recommend this as a client option. – NULL Apr 16 '15 at 18:18
  • Probably would have been better as a comment on Ignacio But yes processing is a good option IF you want to write code by yourself. – aaa Apr 17 '15 at 12:39