pxt-calliope/docs/reference/serial/write-numbers.md
Peli de Halleux 29de28a738
Added serial->write numbers to support CSV data generation (#699)
* support for serial write numbers

* moving down the list

* formatting

* fixing example typo
2018-03-08 08:33:02 -08:00

40 lines
746 B
Markdown

# Serial Write Numbers
Write an array of numbers to the [serial](/device/serial) port.
```sig
serial.writeNumbers([0, 1, 2]);
```
## Parameters
* `values` is the array of [number](/types/number) to write to the serial port
## Example: one two three
This program repeatedly writes a 3-number array to the serial port.
```blocks
basic.forever(() => {
serial.writeNumbers([1, 2, 3]);
basic.pause(5000);
});
```
## Example: plot temperature and light
```blocks
serial.writeLine("temp,light")
basic.forever(() => {
serial.writeNumbers([input.temperature(), input.lightLevel()])
})
```
## See also
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write value](/reference/serial/write-value)