App Designer And Arduino (Reading continuous voltage from Potentiometer )
8 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Roja Boran Gökhan
on 13 Oct 2021
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 Comments
See Also
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!