Trying to get the Robot to react to a sensor only when necessary

I have a Proximity sensor set up to my part dispenser. To tell the robot to stop if there is no part. The problem is it does this at all times, the dispenser takes about 8s to reload, I cant have the robot waiting around for that long, I’ve tried everything I can think of short of writing code.

Hi Slapit,

Which model do you use? Do you use Blockly? Can you share the Blockly project?
Please show me details of the workflow, which step is getting the problem?

Best regards,
Minna

Model
I am using the xArm 5

Work Flow
I designed a mechanical dispenser to present a part to the robot with custom grips. The robot then needs to place the parts in a washing tray with 330 separate pins. If the dispenser quits working I want the robot to know about it and stop too, so I am not sending half empty trays to the washer.
The robot will also be controlling a conveyor and a gentle alarm, and 2 external tools but that’s not very relevant I’ve got those working.

I have improved the code slightly since the other day. Now as you can see the their is a pause right at the end of the code. and a trigger to resume anytime the prox gets flip to positive. but if there was a part already there it would not move and my attempt to put the pause just before the pick results in the program not starting since there is a part already there and the robot seams to only sense changes to DI0 not on or off.

Also I’m realizing I will need some kind of timer (preferably code) that if the robot does stop for more than say 40 seconds I want to to trigger a light and alarm.

Unfortunately I have to assume this robot will be maintained by idiots in day to day operations… because it will. lol You wouldn’t believe the crap I’ve seen.

PS is there a better way to upload files here? Also is there a way to run the robot without a PC connected?

Thank very much Slapit.