PS3BT code

So I have downloaded the USB Host shield library from GitHub, and going through the PS3BT example I found some code I didn't recognise.

if (PS3.PS3Connected || PS3.PS3NavigationConnected) {
if (PS3.getAnalogHat(LeftHatX) > 137 || PS3.getAnalogHat(LeftHatX) < 117 || PS3.getAnalogHat(LeftHatY) > 137 || PS3.getAnalogHat(LeftHatY) < 117 || PS3.getAnalogHat(RightHatX) > 137 || PS3.getAnalogHat(RightHatX) < 117 || PS3.getAnalogHat(RightHatY) > 137 || PS3.getAnalogHat(RightHatY) < 117) {
Serial.print(F("\r\nLeftHatX: "));
Serial.print(PS3.getAnalogHat(LeftHatX));
Serial.print(F("\tLeftHatY: "));
Serial.print(PS3.getAnalogHat(LeftHatY));
if (PS3.PS3Connected) { // The Navigation controller only have one joystick
Serial.print(F("\tRightHatX: "));
Serial.print(PS3.getAnalogHat(RightHatX));
Serial.print(F("\tRightHatY: "));
Serial.print(PS3.getAnalogHat(RightHatY));
}
}

can someone explain to me what the \r\n means in Serial.print(F("\r\nLeftHatX: "));?

can someone explain to me what the \r\n means in Serial.print(F("\r\nLeftHatX: "));?

The \ is an escape character. The \r and \n are carriage return and line feed.

What job does it do in the code?
I read a bit about it and most websites seem to say it was mostly used with typewriters

HelpMe69:
What job does it do in the code?
I read a bit about it and most websites seem to say it was mostly used with typewriters

They start a new line in the serial monitor. Without starting a new line, the message will keep printing on one line.

They start a new line in the serial monitor. Without starting a new line, the message will keep printing on one line.

But it's used in almost every line on the PS3BT library, why don't I see it in any other library? what's so significant about using it in this particular library?

HelpMe69:

They start a new line in the serial monitor. Without starting a new line, the message will keep printing on one line.

But it's used in almost every line on the PS3BT library, why don't I see it in any other library? what's so significant about using it in this particular library?

The person that wrote the library likes neatly printed things with line breaks. I would do the same thing. Where else have you seen lots of serial outputs, you may find some there too, but with println(). The ln generates \r\n after the content to be printed. Don't get hung up on the \r\n. Maybe you are a mac/nix person?