How to use assertion for readpin and abort and recover

Hello friends, it is just a how to make the tool mount and tool inmount more intelligent.

could you please let me know if this syntaxis is correct to express that in the assertion box?

my tool verification pin is 63

return pins[63] == 1.0

if test fails

abort and recover

recover sequence

tool error

@odranreb Have you initialized the variable pins? If not, could you instead try get_pins()[63]?

return get_pins()[63] == 1.0


my pin 63 is initialized previously in the sequence and its value is 1.0 (NO TOOL)

I have tried your way and a lot of different ways with not luck…

I tried for example

return pins[63] == 1.0


return pins[63] == 0.0

and both ways the return value is false

so the IF test FAILS

Best regards

return get_pins()[63] == 1.0


return get_pins()[63] == 0.0

and both ways the return value is false

@odranreb the code fragment that ( our very busy ) @RickCarlino gave above is incorrect.

Try either of these

toolverify = get_pin(63);
toolverify = get_pins()['63'];

-- more code ---

return toolverify == 0;

Note that you don’t need to compare with floating point, but Lua will ‘do the right thing’.

[edit 0] Beware that getting all pins takes many seconds on an Express. Plain get_pin(n) is fast.