writeline

Write line of ASCII data to serial port

Description

example

writeline(device,data) writes the ASCII text data, followed by the terminator, to the specified serial port device. The function blocks MATLAB and waits until the data and terminator are written to the port.

Examples

collapse all

Write an instrument identification query string to a serial instrument. writeline automatically includes the defined terminator.

s = serialport("COM3",9600);
configureTerminator(s,"CR")
 ⋮
writeline(s,"*IDN?")

Input Arguments

collapse all

Serial port, specified as a serialport object.

Example: serialport()

ASCII data to write to serial port, specified as a string or character vector of text.

Example: "IDN?"

Data Types: char | string

Introduced in R2019b