safe break out of a while loop

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

safe break out of a while loop

Postby Battwell » Sun Nov 05, 2017 6:36 pm

what is the safest way of breaking out of a while loop
ie in case of an input led not being found when in while loop

i had a case today where my macro wasnt be able to be stopped
i have a wait 100 in it so it doesnt over run
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 821
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: safe break out of a while loop

Postby Robertspark » Sun Nov 05, 2017 7:39 pm

What was the test?

Code extract of while + explanation

One way to do it is define a counter / timer and run that inside the while loop then return after the duration.

Really you don't want to run too many while loops unless you are waiting for something certain to happen.

Unless it's something like while is loading / stopped I try to stay away from it.... All depends upon what you want to do with it as there may be another way
Last edited by Robertspark on Sun Nov 05, 2017 7:47 pm, edited 1 time in total.
Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: safe break out of a while loop

Postby Robertspark » Sun Nov 05, 2017 7:46 pm

Robertspark
 
Posts: 1892
Joined: Sat Sep 03, 2016 4:27 pm

Re: safe break out of a while loop

Postby Dan911 » Sun Nov 05, 2017 9:46 pm

while (bool == true)
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA


Return to Macros

Who is online

Users browsing this forum: No registered users and 5 guests