write Function

Top  Previous  Next

Sends text data to the serial port.


Cell.Serial[n].write(data [, data ...])



nThe serial port number, 0 - 2.
dataOne or more values to send as text.

Return Value

Zero if successful, or a negative number if failure.


If data is Boolean, number, or array, it is converted to a string. If data is undefined or null it is skipped.


If the serial port's output buffer has sufficient free space, this function will return immediately. Otherwise, execution will pause while data is sent. The bytesCanWrite property returns how many bytes are free in the output buffer.


This function can fail if the serial port has not been enabled by setting its bitRate property to a positive value.


Cell.Serial[1].bitRate = 9600;

val = 92;

Cell.Serial[1].write("Value is: ", val);

Cell.Serial[1].write("; Acceptable: ", val >= 100, "\r\n");

See Also

writeBytes Function, bytesCanWrite Property