GUI interface with arduino
이전 댓글 표시
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
Mohamed Asif
2017년 7월 6일
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
채택된 답변
추가 답변 (2개)
Kaustubha Govind
2011년 3월 24일
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
Tee
2011년 3월 24일
Kaustubha Govind
2011년 3월 24일
Apparently digitalWrite doesn't like boolean values - you can make that:
a.digitalWrite(10,double(ledValue));
heisenberg
2015년 3월 18일
how to access serial pins in above program to send data?
hardik sanghvi
2015년 11월 25일
0 개 추천
How to make pause and counter button code
카테고리
도움말 센터 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!