GUI interface with arduino
Mostrar comentarios más antiguos
now, i try to control arduino board through Matlab GUI(using IO packages). First,i try to light on the LED by click on the push button i create, below is the callback function i put:
a=arduino('com3')
a.pinMode(10,'output');
a.digitalWrite(10,1);
after i try it, the LED only blink for a second, but now i wish to light on the LED continuously, what code should i type? I wish to light on and light off the LED using push button i create...anyone can help me, thanks..
1 comentario
Mohamed Asif
el 6 de Jul. de 2017
https://in.mathworks.com/videos/arduino-and-matlab-reading-inputs-and-writing-outputs-106502.html
use this above link you can get idea about it
Respuesta aceptada
Más respuestas (2)
Kaustubha Govind
el 24 de Mzo. de 2011
You could try using a persistent variable to store that last state, and toggle that each time the callback is fired:
persistent ledValue
if isempty(ledValue)
ledValue = 0;
end
ledValue = ~ledValue; %toggle ledValue
a=arduino('com3');
a.pinMode(10,'output');
a.digitalWrite(10,ledValue);
3 comentarios
Tee
el 24 de Mzo. de 2011
Kaustubha Govind
el 24 de Mzo. de 2011
Apparently digitalWrite doesn't like boolean values - you can make that:
a.digitalWrite(10,double(ledValue));
heisenberg
el 18 de Mzo. de 2015
how to access serial pins in above program to send data?
hardik sanghvi
el 25 de Nov. de 2015
0 votos
How to make pause and counter button code
Categorías
Más información sobre MATLAB Support Package for Arduino Hardware en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!