NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Question: How to stabilize output in terminal window?

June 22, 2011
by Happy
Happy's Avatar

I am able to get output from the MCU (based on the tempsensor project) to display in the terminal window. However, the display in terminal window is wrapping throughout (see below):

termout

Is there a simple way to get the output to refresh in the same area repeatedly? I would prefer if the output would just stay in the upper left portion of the window. Do I need to look at my temp code or the uart.c, or am I way off base? Thanks

June 22, 2011
by Ralphxyz
Ralphxyz's Avatar

first thing is that it looks like you are missing a carriage return.

The Nerkit Temp Sensor project has

printf_P(PSTR("%d\r\n"), adc_read());

that at least stacks everything to the left.

As far as just putting it to the top left you would probable need to use a program (Python) or at least a programable Terminal application.

What you are asking for would be good to have, so let us know when you work it out.

Ralph

June 22, 2011
by Happy
Happy's Avatar

Thanks for the help Ralphxyz! I was missing the r and omitted the /n (which returns to the next/new line). I used the following code (modified as I am converting to Celsius:

printf_P(PSTR("Temp: %.2f C\r"), (temp_avg));
June 22, 2011
by Ralphxyz
Ralphxyz's Avatar

So does that stay in the upper left with just \r?

Ralph

Post a Reply

Please log in to post a reply.

Did you know that NerdKits has been featured on Slashdot, Hack A Day, Hacked Gadgets, the MAKE blog, and other DIY-oriented websites? Learn more...