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

746 B

Serial Write Numbers

Write an array of numbers to the serial port.

serial.writeNumbers([0, 1, 2]);

Parameters

  • values is the array of number to write to the serial port

Example: one two three

This program repeatedly writes a 3-number array to the serial port.

basic.forever(() => {
    serial.writeNumbers([1, 2, 3]);
    basic.pause(5000);
});

Example: plot temperature and light

serial.writeLine("temp,light")
basic.forever(() => {
    serial.writeNumbers([input.temperature(), input.lightLevel()])
})

See also

serial, serial write line, serial write value