set Write Line Padding
Sets the padding length for text lines written to the serial port.
serial.setWriteLinePadding(0)
When text is written to the serial port as a “line”, it can have an amount of padding to keep the line at a certian length. If the write line padding is set to 32 and the length of text sent with write line is only 15 characters, then additional space characters are added to make the line length 32 characters.
Also, the padding length will account for the NEWLINE characters that terminate the line.
In this example, the a line of text "Hello Serial!" is written to the serial port.
serial.setWriteLinePadding(24)
serial.writeLine("Hello Serial!")
In this case, the output will NOT be:
Hello Serial!\r\n
Instead, it will include addtional space characters to make the line length 24 characters:
Hello Serial! \r\n
Parameters
- length: a number between
0and128that sets the padding length for lines of text written to the serial port. The default padding length is32.
Example
Set the write line padding to 48 characters and write a message line to the serial port.
serial.setWriteLinePadding(48)
serial.writeString("This is my SERIAL message!")