There is something I don't understand about serial monitor.
As far as I know the Newline
option is \n
.
The Carriage return
option is \r\n
.
But does that make the Both NL & CR
option \n\r\n
?
2 Answers 2
Newline is \n
Carriage Return is \r
Both NL & CR is \r\n
-
It would be wonderful if this could be called "CR & NL" (note the sequence) or maybe just say \r\n. Because when you read "Both NL & CR" you then scratch your head and say "hm, does this actually mean \n\r".Brad Peabody– Brad Peabody2023年02月18日 00:47:19 +00:00Commented Feb 18, 2023 at 0:47
"Both" means 1 Carriage Return and 1 Newline (formerly known as "Line Feed"). Our present day "standards" are descended from mechanical teletypes that used those separate codes for the two separate mechanical functions: Returning the print carriage to the left side of the page, and scrolling the paper up one line.
The DOS/Windows world adopted the teletype standard (both) as is.
The unix world dropped the carriage return as unnecessary, letting a single character stand for the end of a line, and more modern hardware (or its software drivers) could figure out what to do for the particular device.
The Apple world chose Carriage Return for its standard back in the mists of time, dropping it in later years for a selectable end-of-line sequence where appropriate, but more usually using the unix standard once it's OSes became hosted on unix.
-
Baudot had separate CR LF. It was common to use CR and duplicate part of a line to get "Bold" characters.Milliways– Milliways2016年04月08日 01:47:35 +00:00Commented Apr 8, 2016 at 1:47