How to monitor variables not using the serial?

Hi:

Using the Serial Monitor feature can be uncomfortable as the lines keep in arriving from the board, even enabling the Autoscroll. Is there anyway of popping up a window or anything, even clearing the box in serial monitor after printing each line?

Thanks

rva1945:
Using the Serial Monitor feature can be uncomfortable as the lines keep in arriving from the board, even enabling the Autoscroll. Is there anyway of popping up a window or anything, even clearing the box in serial monitor after printing each line?

  1. Output some number of lines, then use a while() loop to await a "resume" byte, which you will send from the Serial monitor.

  2. Read the Serial port, and if you send it a 'p'' use a while() loop to await an 'r' (pause and resume).

  3. Use a terminal program that lets you send a character without having to click a button or hit Enter, and that has a clear screen button, or has a VT100 emulator so you can send it formatting commands, including clear screen.

  4. Write a small program in your favourite language that does whatever you want with the incoming data stream.

Hterm Serial monitor of awesomeness makes this SIMPLE.

Get it: HTerm - der-hammer ( windows & linux )

Its done using a 'Clear At' function. I use the '!' character to tell the terminal when to clear. A test sketch is below:

void setup() {
  // put your setup code here, to run once:
Serial.begin( 115200 );
}

void loop() {
Serial.print( F("This is line 1, it has text saying its line 1" ) );
delay( 500 );
Serial.print( '!' );
Serial.print( F("This is line 2, there are many lines like it, but this one is mine." ) );
delay( 500 );
Serial.print( '!' );
}

HTERM has all the common settings right on the front, you can see the clear at function circled, and the connection stuff in the top right oops I mean left. The '!' has an ascii code of 33 so I input that:

Each line is displayed for the delay, then cleared when the Arduino sends '!'

pYro_65:
Hterm Serial monitor of awesomeness makes this SIMPLE.

Neat. I must try this.

...R

Don't tell anyone I told you this but you could do a print from an interrupt routine.

So nobody knows who to blame when things go to hell?

Printing from an ISR is not a good idea, because you have no way of knowing whether the buffer you are writing to is nearly full, so you don't know whether there is room for what you plan to write. If there isn't, the underlying write() method will simply wait until there is room. No room will ever be made, of course, since making room relies on interrupts firing, which doesn't happen when an ISR is running.

Printing in an ISR wouldn't help OP anyway.

Still looks like a neat terminal program though...

Doc

PaulS:
No room will ever be made, of course, since making room relies on interrupts firing, which doesn't happen when an ISR is running.

Enable the interrupts...

Thanks, I want to install it in Linux.

Once downloaded, how do I install it?

Neat. I must try this.

DITTO.

Don't tell anyone I told you this but you could do a print from an interrupt routine

.So nobody knows who to blame when things go to hell?

I use Serial.flush() with an counter to empty the buffer if I think there is a chance of that happening.

Waits for the transmission of outgoing serial data to complete. (Prior to Arduino 1.0, this instead removed any buffered incoming serial data.)

I use Serial.flush() with an counter to empty the buffer if I think there is a chance of that happening.

In an ISR? That doesn't stand a hope in hell of working.

It's not in the ISR

It's not in the ISR

Then, how do you determine how many characters can fit in the partially empty buffer? How do you determine when to call flush()? How do you ENSURE that flush() is NOT interrupted?

HTERM is installed and running. Arduino IDE is running and the Serial Monitor is showing values. But when I click (in HTERM) on Connect I get:

Error in OpenPort: Internal error when initializing '/dev/ttyS0.

that port is the same that I'm using in Arduino IDE, the baudrate is the same, though I don't know about the Data, Stop and Parity parameters as they are not shown in the IDE. I tried with different options for those but to no avail.

Then, how do you determine how many characters can fit in the partially empty buffer? How do you determine when to call flush()? How do you ENSURE that flush() is NOT interrupted?

Then, how do you determine how many characters can fit in the partially empty buffer?

I haven't used it yet for anything that has a lot of characters.

How do you determine when to call flush()?

I just set the counter to whatever I think is appropriate for that application. The only example I have is the attached sketch.
The serial monitor capture file is also attached so you can see the serial output for the keypad circuit.

How do you ENSURE that flush() is NOT interrupted?

I don't know how yet.

Matrix_4x4_16_key_keypad_to_74c922_ISR_I2C_LCD_flushcounter.ino (3.22 KB)

ClearTerminal_Capture__KEYPAD_FLUSH_TEST_05.03.2014_10.52.44.txt (227 Bytes)

I don't know how yet.

Then you have no business telling people that Serial.print() is OK in an ISR.

Ok. Sorry. My bad. Do you want me to delete that post ?

@rval1945: I think you can find the info you're looking for in the preferences.txt file. Go to File --> Preferences and at the bottom is the link to the location of your preferences file. In there, you will find something like:

serial.databits=8
serial.debug_rate=115200
serial.parity=N
serial.port=COM2
serial.port.file=COM2
serial.stopbits=1

See if that's what you need.

raschemmel:
Ok. Sorry. My bad. Do you want me to delete that post ?

I suspect it would be better to edit it rather than delete.

Rule #1 of teaching -- always be a few pages ahead of the students.

...R