Info
此问题已关闭。 请重新打开它进行编辑或回答。
Unable to stop Arduino Bluetooth data pulling
1 次查看(过去 30 天)
显示 更早的评论
Hi, I would like to pull information from the arduino through bluetooth and be able to stop the data when a figure is closed. However, once I close the figure the code continues to run, I'm even unable to Ctrl+C in the command and the only way to stop the program is to close matlab.
Any ideas? Thank you
clear
clc
%fclose(instrfind)
%Open Serial COM Port
s = Bluetooth('RNBT-AD09',1);
fopen(s);
fid = fopen( 'Arduino.txt', 'w' );
g = figure;
pause(.5)
while ishandle(g) %Loop when Plot is Active
dat = fscanf(s)
fprintf(fid, '%s\r\n', dat);
end
fclose(fid);
fclose(instrfind);
0 个评论
回答(1 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!