Effacer les filtres
Effacer les filtres

global properties in app designer with arduino

2 vues (au cours des 30 derniers jours)
Brett Hamlin
Brett Hamlin le 4 Mar 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?

Réponses (1)

Mario Malic
Mario Malic le 5 Mar 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')

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by