Undefined function 'voltageRead' for input arguments of type 'double'.
조회 수: 3 (최근 30일)
이전 댓글 표시
I am trying to make a GUI using App Designer that reads and graphs the voltage sensed by my Arduino Uno. When I type on the Command Window the following syntax, I get results.
a=arduino('COM5','uno')
readVoltage(a,'A0')
But when I place the same syntax in a callback function in the App Designer, the error message "Undefined function 'voltageRead' for input arguments of type 'double'." appears. Below is part of my code in the App Designer.
properties (Access = private)
stop;
done=0;
a;
h;
s;
SetPoint;
luxvolt;
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
clear all;
app.a = arduino('COM5','uno');
end
% Button pushed function: StartButton
function StartButtonPushed(app, event)
app.stop = false;
app.h = animatedline(app.UIAxes);
startTime = datetime('now');
axis = gca;
axis.YGrid ='on';
axis.YLim = [0 5];
while ~app.stop
app.luxvolt = voltageRead(app.a, 'A4');
%luxactual = (luxvolt - 1.4565) .* (2300 - 0) ./ (0.3519 - 1.4565) + 0;
t = datetime('now') - startTime;
addpoints(app.h,datenum(t),app.luxvolt);
drawnow
app.stop = app.done;
end
댓글 수: 2
답변 (1개)
Vimal Rathod
2020년 1월 30일
It seems like you have used voltageRead instead of readVoltage function.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!