pxt-calliope/docs/reference/serial/read-string.md
Peli de Halleux d4220593b0 Serial events (#337)
* added "serial->on data received"

* updated info

* updated docs

* added readline to read entire buffer

* lazy initialize of serial buffers

* init async on event

* updated docs
2017-01-22 17:08:59 -08:00

534 B

Serial Read String

Read the buffered serial data as a string

serial.readString();

Returns

  • a string containing input from the serial port. Empty if no data available.

Example

The following program scrolls text on the screen as it arrives from serial.

basic.forever(() => {
    basic.showString(serial.readString());
});

See also

serial, serial write line, serial write value