I am using a custom vacuum gripper. The vacuum is controlled with a relay connected to the controllers GPIO. I also have a vacuum pressure sensor connected to the controllers GPIO. I would like to let de Xarm go down until it detects vacuum. Is there a good way to program this in blockly.

You could program it like that:

I will give it a try. Thanks for the quick response

You are welcome. Have a nice day.

Hi, I tried it today but it did not work. It now goes down when it sees vacuum. I would like it to go down when i want it and stop going down when the vacuum is detected.

Maybe this code will help.

Hi, unfortunaly this also does not work. I think what is happening is that the IF statement is only red after it traveled the 10mm. I want to go down about 300mm. The only way to let it react earlier is to set the True to False. Than it will keep reeding the value of CI0 but the all the commands are stored in a buffer. So when it detects vacuum it first complets the buffer.

The only solution i found so far is the one in this picture. So i use the Stop motion function to clear the buffer and that set the resume state so i can keep moving. the only problem is that the reaction time is 100ms. So if i go down at 50mm/s the tool could go 5mm further than it should causing it to trip the safty. And it sometimes exits the program because of a error about the stop state

Maybe you could try this example: