Read data via serial port

3 visualizaciones (últimos 30 días)
Pavel Filjac
Pavel Filjac el 26 de Feb. de 2020
Respondida: Charan Jadigam el 4 de Mzo. de 2020
Hello, I would like to read for example these datas: "05 04 A9" but when I try it with function read, it returns only datas until the first space. Could you advice me, how can I read whole datas also with spaces?
app.s = serialport(app.a,115200,"DataBits",8, "Timeout",1);
received = read(app.s,59,"string");

Respuestas (1)

Charan Jadigam
Charan Jadigam el 4 de Mzo. de 2020
Hi,
To read string from a serial port, you need to configure termination character first and then read. Use the following functions.
configureTerminator(s,"LF");
data = readline(s);
You can read more about the function configureTerminator

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by