Send char to arduino with Serial, without a \r (or \n)

I am working on moving a stepper using the Serial Monitor.
I have it working.
But:
The problem is that it seems the serial port does not send anything to Arduino unless I hit return ('\r).
(As far as I know.)

So, I can filter the '\r' from the input buffer when parsing the serial.read(), no worries.
But if I'm moving the stepper say 100 steps, one at a time, instead of pressing and holding a repeat mmmmmmmmm for lots of steps I have to press m, then CR, then m, then CR etc.
That, plus I'm moving in 2 dimensions, so I was going to use 4 key letters I want to enter to go +/- x and +/- y.

That many CR is far too slow.

Is there a trick to get the serial monitor to send char without pressing CR?

Or: Does anyone have a different scheme, such as psychokinesis?

I could use a joy stick, etc, or a complex encoding scheme such as enter "100mx" for move x 100 steps, and parse that, or movable hardware stops I could seek out. But all those are a lot more work if there is a simple idea I don't know about....

Thanks in advance.

No, but you could use an alternative terminal program such as Coolterm which will do what you want.

If you set the line ending in serial monitor to none, it will only send the text in the textbox when you press <enter> and no cr and/or lf.

if you use a terminal emulator (I use TeraTerm or RealTerm) as suggested by @UKHeliBob remember

  1. close the Arduino serial monitor before starting the terminal emulator
  2. close the terminal emulator before attempting to use the Arduino IDE to program the device

Thanks horace and UKHeliBob.
So, 3 candidates for work around. Excellent.
Is there a quorum on which to choose with priority on easy to use/learn?

Keep it simple and all that....

(Horace: Thanks for the provisos I was surely going to learn the hard way.)

Thanks,
r44chopper (as in Robinson...)

1. If you want to send the character(s) of the InputBox of the Serial Monitor (Fig-1), you must click on the Send Button or press on the Enter Key of the PC.


Figure-1:

2. When you click on the Send Button (or press the Enter Key), all the characters of the InputBox are transmitted one-after-another and then the ASCII code for the character of the "Line ending tab" is transmitted. The Line ending tab has the following options:
(1) No line ending (nothing will be sent)
(2) Newline (0x0A will be sent)
(3) Carriage return (0x0D) will be sent)
(4) Both NL & CR (0x0D will be sent first and then 0x0A will be sent)

Is exactly what @r44chopper is trying to avoid

1 Like

Is it possible to avoid it in the context of Arduino IDE?

I find Coolterm very easy to use

It has a simple setting that tells it to send each character as it is typed
image
as opposed to sending a line of input by pressing Return

The rest of the setup is just as you would expect, ie choose the serial port, baud, data bits, parity and stop bits as usual and you are in business
image

Our primary Learning Tools are:
Arduino UNO
Arduino IDE
Serial Monitor of Arduino IDE

Should we add the "Coolterm" terminal in the above list?

Add whatever you need at the time you need it

The IDE Serial Plotter, a terminal emulator, an LCD screen, an OLED screen, etc, etc. Whatever is appropriate for your project

Coolterm is a simple terminal emulator that is free to download and use if and when you need it

choice of terminal emulator depends on the functionality you require - i use (both free to download)

  1. TeraTerm is simple and easy to use
  2. RealTerm has lots more options, e.g. display Ascii, ANSI, HEX, etc

have implemented custom terminal emulators when particular functionality is required (e.g. send a complex text string when a key is hit or GUI button pressed) - generally writen in Java (portable across operating systems) but also C++, C#, etc

The obvious thing to do is to try one or more of the suggested emulators and see which suits you best. They can all do the job

I'm torn on who to assign "solution" to. But I have to go with the helicopter guy as you suggested Coolterm which I already have up and running and working properly.
Thanks so much to Horace too!
You guys saved me from certain headaches...
Cheers!

Thanks, but it isn't a competition. What is helpful is that the topic is marked as solved so that anyone finding it later knows that there is a solution to be had in the topic

I have changed the solution attribution to you to keep it fair all round

Are you fully convinced that the Terminal of the Arduino IDE is not suitable for your Project?

I know that you are not asking me but I am convinced that the Serial monitor cannot do what is required, unless you know better, which I would be interested in

The requirement is to send a character as soon as the key is pressed rather than waiting for Return to be pressed. The Line ending setting has nothing to do with this

OP has said the following in his post #1 --

OP can click on the Send Button of the Serial Monitor.

But that does not do what he/she wants if you read what he/she wrote later in their first post

Which to me says that he/she wants only to press a key to send a character to the Arduino and not need to do anything else. You are correct in your assertion that the 'Send' button can be clicked to send the user input but that is surely even worse than having to press Return

Having said that, the situation was confused by him/her mentioning removing '\r' from the Serial buffer because as we both know that is caused by the Line ending setting which could be set to 'No Line Ending' to prevent the '\r' being sent in the first place

1 Like

LOL. Good choice, the helicopter guy.

a7

1 Like