Serial Communication between arduino uno and matlab?
2 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
回答(1 个)
Walter Roberson
2016-5-4
If you want to read one byte at a time you should use fread() instead of fscanf
A = fread(s, 1, 'char');
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!