Borrar filtros
Borrar filtros

Arduino erros using Matlab. (Use Matlab like Monitor Serial)

2 visualizaciones (últimos 30 días)
Szillat
Szillat el 24 de Nov. de 2017
Comentada: Szillat el 9 de Dic. de 2017
Hi, I trying to control one Arduino system and read their output data, just like the monitor serial from the Arduino IDE. I read a little about it, but I only find how to set some outputs signals and/or read some digital outputs. I trying something but it always comes to this message and I can only read the first message that would come in the serial monitor. 'Warning: Unsuccessful read: A timeout occurred before the Terminator was reached..'
s = serial('COM11')
set(s,'BaudRate', 115200)
fopen(s)
out = fscanf(s)
z=1;
while (z==1)
dat = fscanf(s);
fwrite(s,1);
fscanf(s);
end
It's one way that the Matlab works like the serial monitor, I mean, that I can read e write information instantly? I like to use Matlab because sometimes I would like to use some loops and it would be impossible to do automatic in serial monitor from Arduino IDE.
Thanks, everybody.
  4 comentarios
Walter Roberson
Walter Roberson el 24 de Nov. de 2017
Please experiment with changing fwrite(s,1) to fprintf(s,'1\n')
Szillat
Szillat el 9 de Dic. de 2017
it works, thanks.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by