pxt-calliope/docs/reference/serial.md
Peli de Halleux ea2361792f
Adding serial.set(Rx|Tx)BufferSize (#1931)
* Fix for https://github.com/Microsoft/pxt-microbit/issues/1929

* bump pxt

* updated docs

* fix default values

* moving dialogs to react

* moving to react

* typo

* typo
2019-03-21 08:04:48 -07:00

1.2 KiB

Serial

Read and write data over a serial connection.

serial.writeLine("");
serial.writeNumber(0);
serial.writeValue("x", 0);
serial.writeString("");
serial.writeNumbers([0]);
serial.readUntil(",");
serial.readLine();
serial.readString();
serial.onDataReceived(",", () => {})

Advanced

serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
serial.redirectToUSB();
serial.writeBuffer(pins.createBuffer(0));
serial.readBuffer(64);
serial.setRxBufferSize(64);
serial.setTxBufferSize(64);

See Also

writeLine, writeNumber, writeValue, writeString, writeNumbers, readUntil, readLine, readString, onDataReceived, redirect, writeBuffer, readBuffer, redirectToUSB, set rx buffer size, set tx buffer size