Serial Write Numbers

Write an array of numbers to the serial port.

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

Instead of writing a single number at a time using write number, you can write multiple numbers to the serial port at once. They are written as Comma Separated Values (CSV).

You can write the numbers 0 through 5 together and they will appear as one line of serial output:


This makes a line of CSV data where the commas between the numbers are the separators for each value.


  • values: the array of numbers to write to the serial port

Example: one two three

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

basic.forever(function() {
    serial.writeNumbers([1, 2, 3])

Example: plot temperature and light

basic.forever(function() {
    serial.writeNumbers([input.temperature(), input.lightLevel()])

See also

serial, serial write line, serial write value