I am currently using the Arduino Serial Monitor to send a command string
[s123][m123]
with the "newline" enabled at the bottom. If turned with no newline; it does not work. I would like to use a joystick for easier control; I am using java. However; simply adding "\n" to the string does not work. What does arduino use to enable a newline?
The button at the bottom of the screen (normally says "No line ending") controls which line ending is sent after the data, when you hit the "send" button.
i am aware of that. but i am looking for a way to concatenate the newline in java. adding "\n" does not work. what can i use in java so arduino can understand newline?
Specifically, which setting have you selected? There are three choices. One appends nothing. One appends \r (or \n). The 3rd one appends both \r and \n, in some order. It isn't that difficult, unless you are lazy like me, to write a sketch that determines the correct order and value(s) appended.
what can i use in java so arduino can understand newline?
So your question has nothing to do with the "Serial Monitor" at all?
Arduino doesn't "understand" newline (unlike dealing with a unix or DOS command-line "read()", for example.) You can have it look for whatever your java app sends. (now: "What does a java app send when you specify "\n" in a string sent to the serial port?" is an interesting question...)
@joojieman, Can you tell us exactly what you are trying to do. I can't figure if you want the Java program to read or to send the data with (or without) the newline character.
...R
PS
KenF:
Since we don't have the benefit of your javascript code, it's just guesswork.
Java, NOT javascript - let's not get hopelessly confused.