App Designer _ PushButton Callback
62 ビュー (過去 30 日間)
古いコメントを表示
Hello to everyone:)
I have a little problem with the PushButton Callback using AppDesinger.
Problem:
Press PushButton: run motor via serial communication (Arduino)
Release PushButton: stop motor
Working with the App Designer is absolutely new for me - so thanks in advance for your help.
Cheers,
Verena
0 件のコメント
回答 (1 件)
Abhilash Padma
2019 年 11 月 5 日
It is better to use “State Button” rather than “Push Button” in app designer in your use case. When the Push Button is clicked once, the button appears to press and release. When the State Button is clicked, the button remains in the pressed or released state until it is clicked again. Use the “value” variable in the ButtonValueChanged callback of the State Button to run or stop your motor. Look at the following callback code of State Button which might help you.
function ButtonValueChanged(app, event)
value = app.Button.Value;
if value==1
% command to run motor
else
% command to stop motor
end
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!