global properties in app designer with arduino

5 visualizaciones (últimos 30 días)
Brett Hamlin
Brett Hamlin el 4 de Mzo. de 2024
Respondida: Mario Malic el 5 de Mzo. de 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?

Respuestas (1)

Mario Malic
Mario Malic el 5 de Mzo. de 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')

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by