Serial Communication between arduino uno and matlab?

2 visualizaciones (últimos 30 días)
Rishabh Garg
Rishabh Garg el 4 de Mayo de 2016
Respondida: Walter Roberson el 4 de Mayo de 2016
I am trying to open folder('C:') with serial communication via Arduino Uno. Can anyone tell me what is the problem in code? Code am using is:
s=serial('COM4');
fopen(s);
tic
while (toc<1)
A=fscanf(s);
if ( A == '1')
winopen('C:')
end
end
fclose(s);
delete(s);

Respuestas (1)

Walter Roberson
Walter Roberson el 4 de Mayo de 2016
If you want to read one byte at a time you should use fread() instead of fscanf
A = fread(s, 1, 'char');

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