You can use an installation variable to keep track of that, set it to 0 initially. When you drop one in the box increment the counter, you can either use the set function or an assignment function.
Wrap your code inside of an if statement and have it only execute the code when the counter is less than 4, else go to the end of the code. You can use a popup to ask the operator to alert the robot when the parts have been replenished and then set the counter back to 0 using the assignment function. Do the popup inside the else statement of the if.
if counter<4:
#execute your code here
#increment the counter when you drop one in the box
counter=counter+1
else
popup alert
counter=0
I would have the if statement execute 1x for each of the parts, incrementing the pickup position to the new position each time. If you want to use static waypoints you can place them inside a switch statement and use the current counter value to determine which pickup point you are using
Set your program to loop continuously and you wont have any issues.
Hello,
How does one program a simple part counter? Currently the program I have running takes parts in a line sequence one at a time. The robot then deburrs the product, drops the finished part where it was removed from, moves to the next part in line...etc. There are a total of 4 parts placed in a fixture. I need the robot to stop after four pieces are completed. How would one program the robot to do this?