2016-12-08 17:28:28 +01:00
|
|
|
# Serial Read Until
|
|
|
|
|
|
|
|
Read a text from the serial port until a delimiter is found.
|
|
|
|
|
|
|
|
```sig
|
|
|
|
serial.readUntil(",");
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Returns
|
2016-12-08 17:28:28 +01:00
|
|
|
|
2017-03-16 15:57:41 +01:00
|
|
|
* a [string](/types/string) containing input from the serial port, such as a response typed by a user
|
2016-12-08 17:28:28 +01:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Example
|
2016-12-08 17:28:28 +01:00
|
|
|
|
|
|
|
The following example reads strings separated by commands (``,``).
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
let answer = serial.readUntil(",");
|
|
|
|
serial.writeLine(answer);
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## See also
|
2016-12-08 17:28:28 +01:00
|
|
|
|
|
|
|
[serial](/device/serial),
|
|
|
|
[serial write line](/reference/serial/write-line),
|
|
|
|
[serial write value](/reference/serial/write-value)
|