App Designer And Arduino (Reading continuous voltage from Potentiometer )
조회 수: 8 (최근 30일)
이전 댓글 표시
Hello,
I am new to App designer. I am trying to read the voltage from Anaolog input from the Arduino uno and desplay the change of the voltage on Gauge using readVotage(), but it does not work. It read reads the first value when I first starts the app, but when I keep changing the voltage from the potentiometer, it does not update in the Gauge.
Here is the code.
function SwitchValueChanged(app, event)
value = app.Switch.Value; % using a sweitch just to controll the code and LED
voltage= readVoltage(app.a,"A0");
if value == "On"
writeDigitalPin(app.a,"D9",1);
app.Gauge.Value = voltage;
app.EditField.Value=voltage;
else
writeDigitalPin(app.a,"D9",0);
app.Gauge.Value = 0;
app.EditField.Value=0;
end
end
By the way, when I run the code in a normal Matlab scripts, it works prefect and the voltage reading updates whenever I change the value of the potentiometer.
Any help with explantion would be appriciate it.
Thank you in advance.
댓글 수: 0
답변 (1개)
Roja Boran Gökhan
2021년 10월 13일
Hello, Could you find the answer? Because i got the same problem with you but i couldn't figure it out. I hope you can help me
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!