App Designer - timer with random interruption
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello, maybe somebody know what is not working correct.
I implanted a timer (replaced a loop) for measurements my motor data. But sometimes if I increase/decrease with a spinner my velocity of the motor, the timer finished before I push the stop bottom. It happen always randomly. I guess something is affecting each other but I don’t know what. Maybe anyone has an idea?
Thanks a lot :)
methods (Access = private)
function MemoryTimerFcn(app,~,~)
% read my data (now I just put two inside=
app.actualVelocity.Value = webread()
app.actualMotorCurrent.Value = webread()
end
% .....a lot of other functions
end
function startupFcn(app)
app.MemoryTimer = timer(...
'ExecutionMode', 'fixedRate', ...
'Period',0.2, ...
'BusyMode', 'drop',...
'TimerFcn', @app.MemoryTimerFcn);
end
function MotorON(app, event)
start(app.MemoryTimer);
end
function MotorOFF(app, event)
stop(app.MemoryTimer);
end
댓글 수: 2
Geoff Hayes
2021년 1월 26일
Chris - can you show where you call MotorON and MotorOff? Is the second function only called when you want to stop the motor (how do you know when to call this?) and is this function the only way to stop the timer? Also, how do you know that the timer has stopped prematurely - is there some sort of indication in the console (or whatever) output?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!