Rewrote/expanded serial topic

This commit is contained in:
Ron Hale-Evans 2016-07-08 11:46:51 -07:00
parent 5099b11823
commit 45d4caf595

View File

@ -1,14 +1,32 @@
# Write Line # Serial Write Line
Writes a string and a new line character (`\r\n`) to [serial](/device/serial). Write a string to the [serial](/device/serial) port and start a new line of text
by writing `\r\n`.
```sig ```sig
serial.writeLine(""); serial.writeLine("");
``` ```
### Parameters
* `line` is the [string](/reference/types/string) to write to the serial port
### Example
This program writes the word `BOFFO` to the serial port repeatedly.
```blocks
basic.forever(() => {
serial.writeLine("BOFFO");
basic.pause(5000);
});
```
### Example: streaming data ### Example: streaming data
The following example constantly checks the [compass heading](/reference/input/compass-heading) and sends the direction to serial. This program checks the
[compass heading](/reference/input/compass-heading) and sends the
direction to the serial port repeatedly.
```blocks ```blocks
basic.forever(() => { basic.forever(() => {
@ -26,8 +44,7 @@ basic.forever(() => {
} }
}) })
``` ```
### See also ### See also
[serial](/device/serial), [write value](/reference/serial/write-value) [serial](/device/serial),
[serial write value](/reference/serial/write-value)