You should be able to simplify the code:
while(get_standard_digital_in(0) == False):
sleep(0.01)
end
Can be written:
while not get_standard_digital_in(0) :
sleep(0.01)
end
Also you should be able to write:
If get_standard_digital_in(0):
var_1
end
The code looks correct to me. Maybe there are some details that can only be seen by looking at the complete script.
Greetings DoF community,
I am trying to write an if-statement in an URscript but I haven’t been successful.
Before the if-statement, I have this while loop:
\r\nwhile(get_standard_digital_in(0) == False):
sleep(0.01)
end
This loop works perfectly. I thought the same method would apply to the if-statement but after many tries, I am not able to run the code. This is what I have now:
\r\nif(get_standard_digital_in(0) == True):
var_1 = True
end
Before the while loop I have:
\r\nglobal var_1 = False
Unfortunately, this code does not run with the if-statement, even though it runs fine without it so the trouble is definitely in how I am writing it. Any help is much appreciated.
Best regards,
Pedro Monforte