Filter löschen
Filter löschen

global properties in app designer with arduino

2 Ansichten (letzte 30 Tage)
Brett Hamlin
Brett Hamlin am 4 Mär. 2024
Beantwortet: Mario Malic am 5 Mär. 2024
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?

Antworten (1)

Mario Malic
Mario Malic am 5 Mär. 2024
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')

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by