I have two buttons (ON and OFF) and two static text fileds created in GUIDE. I'm using buttons to start and stop a DC motor. I'm reading encoder signals from the encoder and I want to write/display those readings continuously by updating to two static text fields.
After tryign so many different things, I'm trying a timer function now. The error I'm getting is Error while evaluating TimerFcn for timer 'timer-1' Not enough input arguments.
Please can someone let me know where I'm making the mistake?
This is the function I call with TimerFcn:
function updateEncoderReadings(hObject, eventdata, handles)
encoderCountValue and encoderRPMValue are set in GUIDE as two text fields' tags.
I'm declaring and initializing my timer once the ON button has been pressed:
function startButton_Callback(hObject, eventdata, handles)
t = timer('ExecutionMode','fixedRate','TasksToExecute',inf,'TimerFcn',@updateEncoderReadings);
set(handles.motorRunStatusText,'String','Motor is running');
And the stop function, for when the OFF button is pressed:
function stopButton_Callback(hObject, eventdata, handles)
set(handles.motorRunStatusText,'String','Motor is not running');
So I'm not quite sure which other arguments I should pass between the functions, and why the text fields are not being updated.
Also, I know the use of global variables is frowned upon but I don't know how else to do this. Any tips would also be appreciated.