global properties in app designer with arduino

5 ビュー (過去 30 日間)
Brett Hamlin
Brett Hamlin 2024 年 3 月 4 日
回答済み: Mario Malic 2024 年 3 月 5 日
This works:
properties (Access = private)
s = servo(arduino('com3','uno','Libraries','Servo'),'D5');
end
but not this:
properties (Access = private)
bb = arduino('com3','uno','Libraries','Servo');
s = servo(bb,'D5'); % s=servo(app.bb,'D5') didn't work either;
end
why - how - and how to explain this to my students.....?
Is there a better way to have an APP access and run an arduino?

回答 (1 件)

Mario Malic
Mario Malic 2024 年 3 月 5 日
I would suggest you to implement your second code in the startupFcn callback. This is the callback that runs when the app is loaded.
Have your properties block
properties (Access = private)
bb
s
end
and startupFcn callback, or make this as a button callback
app.bb = arduino('com3','uno','Libraries','Servo');
app.s = servo(app.bb,'D5')

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by