How do I print to the serial terminal the backslash as a "\"?

It seems like a really easy thing to do, but I want the serial terminal to print \ as a "\" and not a see it as control character start such as \r or \n? I played with everything I could think of. When someone shows me what to do, I'm sure it will be a "Duh moment". PS I searched this a fair bit, but searching for print finds all sorts sketches with the typical Serial.print("BlaBla whatever \r"); type lines. I couldn't even figure out how to narrow the searches to show me what I wanted. It's been a frustrating morning:)

  Serial.println("\\");

Really? That's not the Duh Moment I thought I would have. I'd never had thought of that. Thanks a bunch.

Try google next time :)

http://en.wikipedia.org/wiki/Escape_sequences_in_C

UKHeliBob:   Serial.println("\\");

Or Serial.println('\\'); to be more precisely printing a \ character.

That's OK if you want to print the \ on its own but not if it is part of a literal string.

write it as a byte

Serial.write(92); // 0x5C;

Or if the \ is in a string one can always print it by converting the char array to a byte array and explicitely tell the string length

char s[] = "1234567890";

void setup()
{
  Serial.begin(115200);
  s[5] = 92;  // insert \ into the char array;
  Serial.write((uint8_t *) s, strlen(s));
}

void loop(){}