2017-12-12 07:34:33 +01:00
|
|
|
# write Buffer
|
2017-04-21 18:02:29 +02:00
|
|
|
|
|
|
|
Write a buffer to the [serial](/device/serial) port.
|
|
|
|
|
|
|
|
```sig
|
|
|
|
serial.writeBuffer(pins.createBuffer(0));
|
|
|
|
```
|
|
|
|
|
2017-12-12 07:34:33 +01:00
|
|
|
You place your data characters into an existing buffer. All of the data, the length of the buffer, is written to the serial port.
|
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Parameters
|
2017-04-21 18:02:29 +02:00
|
|
|
|
2017-12-12 07:34:33 +01:00
|
|
|
* **buffer**: a [buffer](/types/buffer) to write to the serial port.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
Read some characters of data from a device connected to the I2C pins. Write the data to the serial port.
|
|
|
|
|
2019-06-06 01:28:56 +02:00
|
|
|
```typescript
|
2017-12-12 07:34:33 +01:00
|
|
|
pins.i2cWriteNumber(132, NumberFormat.UInt8LE, 0);
|
|
|
|
let i2cBuffer = pins.i2cReadBuffer(132, 16, false);
|
|
|
|
serial.writeBuffer(i2cBuffer);
|
|
|
|
```
|
|
|
|
|
|
|
|
## See also
|
|
|
|
|
|
|
|
[read buffer](/reference/serial/read-buffer)
|