Use Event in a Loop Blockly

Hello

I have a simple problem i think, but i can see no solution…

I want to move down the Arm in a Loop like:

for (var count = 0; count < 10; count++) {
// Let uArm move relatively in absolute coordinates.
await UArm.set_position({“z”: -1, “relative”: true});
}

But i want to check the switch of the suction cup is pressed and then stop like:

UArm.TipSensor.addEventListener({“callback”: async function(){
break;
}});

Hope someone can help.

regards

markus

Do you want to ask how to get the feedback of the suction cup? Like that?