Export to GitHub

arduino - issue #119

Ability to specify line endings in the serial monitor


Posted on Sep 19, 2009 by Happy Giraffe

I'm using Arduino 0017 (and very happy with the detached serial monitor)

When using the serial monitor, there is no way to send a \n or \r to the arduino. If I type in a line and hit enter, the line is sent with no line ending. I've had to switch what character I look for to terminate input to something else in order to work around the problem.

I've been using Arduino 0017 on Mac, interfacing with diecimila, duemilanove (328), and Modern Devices RBBB (both stock and converted to 3.3V/8Mhz and reflashed with the pro mini bootloader).

Comment #1

Posted on Jan 20, 2010 by Happy Rhino

I was annoyed by the same incapability to send special characters. Attached is a solution for this.

The patch adds a checkbox in the Serial Monitor. When this checkbox is checked, escaped characters are parsed. The parsed characters are: \r, \n, \t, \b, \f, \0 and \.

Even though Java allows 0-characters in a String, mainly for increased performance, I have added Serial.write(byte[] bytes, int start, int length).

If you have any comments, please share.

Attachments

Comment #2

Posted on Jan 30, 2010 by Massive Horse

Oh, great. Thanks a lot, I was just gonna smash my head with the wall lol

Could you please tell us how to install this patch though?

Thanks

Comment #3

Posted on Apr 1, 2010 by Happy Rhino

(No comment was entered for this change.)

Comment #4

Posted on May 16, 2010 by Happy Rhino

(No comment was entered for this change.)

Comment #5

Posted on Jun 10, 2010 by Happy Rhino

Today I noticed my patch doesn't work against the latest trunk version. Mainly because the status label was removed from the serial monitor.

Attached is a new patch. I have added a new escape character that I was missing myself and fixed the compile errors on the status label.

The added character is \x, which can be used to send raw bytes. Like this: \x00\x02\x04\xff Or even: an @ is \x40

Since there's no status label to show information to the user, it's now throwing exceptions that'll land in the output window and prevent the line from being sent. Other than the explicit IllegalArgumentExceptions in the source, it could also throw an ArrayIndexOutOfBoundsException (e.g. for "\x" or "\x0").

If this is not in line with the coding standards of the Arduino IDE, I'd be happy to help sorting this out.

Attachments

Comment #6

Posted on Jul 11, 2010 by Happy Rhino

r989

I just added support for specifying line terminators. Ability to send and receive arbitrary binary data would be nice, but seems like a separate issue. I imagine creating a separate UI (e.g. another tab in the serial monitor) for binary communication, rather than overloading the text field to accept escape sequences.

Status: Fixed

Labels:
Type-Defect Priority-Medium Milestone-0019 Component-IDE OpSys-All