2016-04-16 01:36:31 +02:00
|
|
|
# Serial
|
|
|
|
|
2017-07-24 22:40:36 +02:00
|
|
|
Read and write data over a serial connection.
|
2016-04-16 01:36:31 +02:00
|
|
|
|
|
|
|
```cards
|
|
|
|
serial.writeLine("");
|
2016-05-19 22:56:24 +02:00
|
|
|
serial.writeNumber(0);
|
2016-08-10 11:51:55 +02:00
|
|
|
serial.writeValue("x", 0);
|
2016-05-19 22:56:24 +02:00
|
|
|
serial.writeString("");
|
2018-03-08 17:33:02 +01:00
|
|
|
serial.writeNumbers([0]);
|
2017-01-10 19:26:44 +01:00
|
|
|
serial.readUntil(",");
|
2016-05-19 22:56:24 +02:00
|
|
|
serial.readLine();
|
2017-01-10 19:26:44 +01:00
|
|
|
serial.readString();
|
|
|
|
serial.onDataReceived(",", () => {})
|
2016-04-16 01:36:31 +02:00
|
|
|
```
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Advanced
|
2017-04-21 18:02:29 +02:00
|
|
|
|
|
|
|
```cards
|
|
|
|
serial.redirect(SerialPin.P0, SerialPin.P0, BaudRate.BaudRate115200);
|
2017-12-14 15:44:48 +01:00
|
|
|
serial.redirectToUSB();
|
2017-04-21 18:02:29 +02:00
|
|
|
serial.writeBuffer(pins.createBuffer(0));
|
|
|
|
serial.readBuffer(64);
|
|
|
|
```
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## See Also
|
2016-08-08 22:08:15 +02:00
|
|
|
|
2017-07-24 22:40:36 +02:00
|
|
|
[writeLine](/reference/serial/write-line), [writeNumber](/reference/serial/write-number), [writeValue](/reference/serial/write-value),
|
2018-03-08 17:33:02 +01:00
|
|
|
[writeString](/reference/serial/write-string),
|
|
|
|
[writeNumbers](/reference/serial/write-numbers), [readUntil](/reference/serial/read-until), [readLine](/reference/serial/read-line),
|
2017-07-24 22:40:36 +02:00
|
|
|
[readString](/reference/serial/read-string), [onDataReceived](/reference/serial/on-data-received),
|
2017-12-16 01:46:16 +01:00
|
|
|
[redirect](/reference/serial/redirect), [writeBuffer](/reference/serial/write-buffer), [readBuffer](/reference/serial/read-buffer),
|
2017-12-14 15:44:48 +01:00
|
|
|
[redirectToUSB](/reference/serial/redirect-to-usb)
|