Trigger Blockly Program with Optical Switch

I am looking to use an optical switch as an input to the uArm which triggers different parts of a blockly program when the switch is activated.

For instance in place of ‘wait until: key pressed’, have ‘wait until: switch on’
31|388x343

Does anyone have any advice on how to integrate an optical switch with the uArm robot?

Thanks

How about try it on Python lib?