Pages: [1]   Go Down
Author Topic: How to send a <return> with Serial Monitor  (Read 2512 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can I use the Serial Monitor to send a <return> (CHR$(13))?
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Right now, you can't, although this is something I'd like to add.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46224
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use some other terminating character, and have the Arduino recognize that character or the CR as the carriage return.

You could also write your own version of the Serial Monitor window. I did that in C# in less than an hour. Mine can send, or not, the CR/LF combo.
Logged

London
Offline Offline
Faraday Member
**
Karma: 8
Posts: 6240
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Right now, you can't, although this is something I'd like to add.
that would be a very welcome addition.

I have noticed that some people assume that a cr/lf will be sent at the end of every message sent from serial monitor. Having an option to enable this behaviour would help for them.
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Right now, you can't,

Thanks.  It's nice to know I wasn't missing something.
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
You could use some other terminating character, and have the Arduino recognize that character or the CR as the carriage return.
I saw that mentioned when I was searching for a way to send a CR.  I didn't see how to do it however.

Quote
You could also write your own version of the Serial Monitor window. I did that in C# in less than an hour. Mine can send, or not, the CR/LF combo.
You make it sound so easy  smiley
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have noticed that some people assume that a cr/lf will be sent at the end of every message sent from serial monitor.
I was trying to interface the Arduino with another software package, which does send a CR (but not a LF) at the end of every message.  But it's easier to debug my Arduino code if I can use println messages at certain spots, so I was hoping to use the Serial Monitor to send/receive.  The ability to send a CR would be helpful indeed.  But I've learned to manage without  8-)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46224
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I didn't see how to do it however.

Suppose that you decide that the terminating character is CR or @. Since you can't send the CR, you have to send the @. That shouldn't be too hard to figure out how to do.

If the data being sent controls an LED on a pin, you might send 'O', 'n', ',', '1', '3', '<CR>' from the program. In the serial monitor, you'd type "On,13@" instead.

Then, in the Arduino code, break out of the loop for reading serial data when the character read was a CR or an @.
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 170
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That makes sense.  Thanks.
Logged

Pages: [1]   Go Up
Jump to: