Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

stop a function using timer when mouse movement MATLAB

Status
Not open for further replies.

emperror123

Member level 5
Member level 5
Joined
Dec 11, 2010
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
1,880
hi all
i m new in the MATLAB, currently i working on project where it need to use mouse movement

condition
1. when mouse is moving with different coordinate, the screen will not turn off
2. when the mouse is stop for certain period, the screen will turn off
3. the system need to be keep looping

the problem i faced and need help from u guys, any solution and suggestion are welcome, i would be appreciated that

1. when the mouse moving, the timer function not able check or interrupt and will off automatically when time reached
2. after it finish or successfully turn off the screen, when screen on back, the screen not able to check the code and will not off the screen after 1st time off

below are the code i write
function turnoff
disp('10secs')
t = timer('TimerFcn',@timerCallback,'StartDelay', 10); % set timer function (10s)
start(t); % start timer with single shot
wait(t); % wait for timer to stop
h = uicontrol('Style', 'radiobutton');
v = get(h, 'Value')
if(get(uicontrol('Style', 'radiobutton'),'Value')== 0)
run('TurnScreenOFF.m'); % turn screen off
end
delete(t)


function timerCallback(timerObj,event,str_arg)
% this function is executed every time the timer object triggers

% read the coordinates
coords = get(0,'PointerLocation');
% print the coordinates to screen
fprintf('x: %4i y: %4i\n',coords)

end % function

hope to hear from u all soon
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top