Rewrote/expanded serial topic
This commit is contained in:
Родитель
5099b11823
Коммит
45d4caf595
|
@ -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
|
||||
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
|
||||
|
||||
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
|
||||
basic.forever(() => {
|
||||
|
@ -26,8 +44,7 @@ basic.forever(() => {
|
|||
}
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
[serial](/device/serial), [write value](/reference/serial/write-value)
|
||||
|
||||
[serial](/device/serial),
|
||||
[serial write value](/reference/serial/write-value)
|
||||
|
|
Загрузка…
Ссылка в новой задаче