2017-01-10 19:26:44 +01:00
|
|
|
# Serial Read String
|
|
|
|
|
|
|
|
Read the buffered serial data as a string
|
|
|
|
|
|
|
|
```sig
|
|
|
|
serial.readString();
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Returns
|
2017-01-10 19:26:44 +01:00
|
|
|
|
2017-03-16 15:57:41 +01:00
|
|
|
* a [string](/types/string) containing input from the serial port. Empty if no data available.
|
2017-01-10 19:26:44 +01:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Example
|
2017-01-10 19:26:44 +01:00
|
|
|
|
|
|
|
The following program scrolls text on the screen as it arrives from serial.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.forever(() => {
|
|
|
|
basic.showString(serial.readString());
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## See also
|
2017-01-10 19:26:44 +01:00
|
|
|
|
|
|
|
[serial](/device/serial),
|
|
|
|
[serial write line](/reference/serial/write-line),
|
|
|
|
[serial write value](/reference/serial/write-value)
|