This commit is contained in:
parent
7f27432222
commit
66d3c6c7e8
28
docs/reference/serial/read-until.md
Normal file
28
docs/reference/serial/read-until.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Serial Read Until
|
||||||
|
|
||||||
|
Read a text from the serial port until a delimiter is found.
|
||||||
|
|
||||||
|
```sig
|
||||||
|
serial.readUntil(",");
|
||||||
|
```
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
|
||||||
|
* a [string](/reference/types/string) containing input from the serial port, such as a response typed by a user
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
The following example reads strings separated by commands (``,``).
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
basic.forever(() => {
|
||||||
|
let answer = serial.readUntil(",");
|
||||||
|
serial.writeLine(answer);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### See also
|
||||||
|
|
||||||
|
[serial](/device/serial),
|
||||||
|
[serial write line](/reference/serial/write-line),
|
||||||
|
[serial write value](/reference/serial/write-value)
|
Loading…
x
Reference in New Issue
Block a user