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
If they say it can't be done- I find a way!
Battwell
 
Posts: 374
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.
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 988
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: safe break out of a while loop

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

Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 988
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: safe break out of a while loop

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

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


Return to Macros

Who is online

Users browsing this forum: No registered users and 2 guests