pxt-calliope/docs/reference/serial/write-number.md
2016-07-11 11:13:13 -07:00

809 B

Serial Write Number

Write a number to the serial port.

serial.writeNumber(0);

Parameters

  • value is the number to write to the serial port

Example: one through ten

This program repeatedly writes a 10-digit number to the serial port.

basic.forever(() => {
    serial.writeNumber(1234567890);
    basic.pause(5000);
});

Example: plot bar graph does serial

If you use the led.plotBarGraph function, it writes the number being plotted to the serial port too.

basic.forever(() => {
    led.plotBarGraph(input.lightLevel(), 255)
    basic.pause(10000);
})

See also

serial, serial write line, serial write value