Serial communication

David Vaughan dvk at dvkconsult.com.au
Thu Jan 12 22:48:58 EST 2006


On 13/01/2006, at 9:37, Camm29" <Camm29 at tesco.net> wrote:
>
> David thanks , that's seems to do the trick.
> Any ideas how to break out of repeat loops in say 10 seconds as a  
> timeout ?

Glad it worked for you.

I take it you want a loop to execute but stop after an amount of time  
apart from any other condition.
Leaving aside mechanisms which will simply kill the handler,  you  
will probably need to check the time before the loop, add ten seconds  
to it and then inside the loop check the current time to see if you  
have reached that the nominated expiry time yet.
e.g.
put the seconds + 10 into expiry
put false into timedOut
repeat <on some other condition>
   <do something useful>
   if the seconds > expiry then
	put true into timedOut
	exit repeat
   end if
end repeat
-- Now checking timedOut will tell you under what condition you did  
exited, normally or by time.

Does anyone have a more elegant solution for this?

regards
David



More information about the use-livecode mailing list