3

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?

5

Newline is \n

Carriage Return is \r

Both NL & CR is \r\n

3

"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 Apr 8 '16 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.