Home Programming


Left ArrowBack to discussions page
tonyatanyatonyatanya Posts: 12 Apprentice
Hi, I have another one for you guys. I am filling cups with a material and moving up in the z direction while its filling. If the program is paused I have the material flow stop so we don't overfill the cups. When I go back to running the program, the robot returns to the original position before the pause, but will not re-engage the output to allow material flow until it finishes the current move command.  How can i re-engage the output to allow material flow at the same place the program is paused? 


  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,131 Handy
    The easiest way to do that is to use a background thread.  In the main program you would use a variable to signify you want the flow on.  Then in the thread just monitor for that state and turn the output on or off.

    For instance:
    local startDispensing = True
    local startDispensing = False
    thread Thread_1()
      while (True)
        set(DO0, startDispensing)
        wait(startDispensing != DO0)
    Just make sure you set the thread to always loop (that is what the while statement above refers to)

    This way when the program resumes, the output will not have the same value as the variable and so it will set the output back to the value of the variable.

  • tonyatanyatonyatanya Posts: 12 Apprentice
    Thanks, Ill give that a shot.  

Sign In or Register to comment.
Left ArrowBack to discussions page