Hi,
Println does a carriage return in addition to a "new line" character ('\n') is there anyway to disable this or is it necessary to do a
Serial.print('stuff');
Serial.print('\n');
Each time?
Hi,
Println does a carriage return in addition to a "new line" character ('\n') is there anyway to disable this or is it necessary to do a
Serial.print('stuff');
Serial.print('\n');
Each time?
s there anyway to disable this
No.
or is it necessary to
Write your own printlf() function. Add it to the Print class so you can print anything followed by just a line feed.
Or make the receiver deal with (i.e. ignore) the carriage return.
Why would it be a problem ?
Use it like this:
Serial.print("Hello World");
Serial.print("Hello World\r");
Serial.print("Hello World\n");
Serial.print("Hello World\r\n");
Serial.print("Hello World\r\n\r\n\r\n\r\n");
computersarecool:
is it necessary to do a
Serial.print('stuff');
Serial.print('\n');Each time?
You need to use double quotes not single quotes. With that corrected, there's nothing stopping you from include newline characters (or any other special characters) within your string. You can even include multiple lines in the same string if you want.