필터 지우기
필터 지우기

global properties in app designer with arduino

조회 수: 2 (최근 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 CenterFile Exchange에서 Develop 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