Does this line of logic work
ollitap
✭
I want to give a person 30 seconds to make a decision. Push the button and the robot will go Home, do not push the button and after 30 seconds the robot will continue its program.
I wrote this logic. Does it work? I have not tested it. Does anyone have a better way?
---- WaitUntil GreenButton=1 or TimeFlag and Maxtime>0;
I did time flag as VAR Bool Timeflag:=False ----- VAR num MaxTime:=30
I am not sure this will start timing??
I wrote this logic. Does it work? I have not tested it. Does anyone have a better way?
---- WaitUntil GreenButton=1 or TimeFlag and Maxtime>0;
I did time flag as VAR Bool Timeflag:=False ----- VAR num MaxTime:=30
I am not sure this will start timing??
Tagged:
0
Answers
-
Hello,You can use this code:
VAR bool bTimeFlag; VAR num nMaxTime:=30; ... WaitDI GreenButton, 1, \MaxTime:=nMaxTime \TimeFlag:=bTimeFlag \Visualize \Header:="Waiting for signal" \MsgArray:=["Movement will not start until", "the condition below is TRUE"] \Icon:=iconError;
☑️2024 - RobotStudio® User Group0 -
Here is what I have. The person has 30 seconds to decide to push the button or the robot will goto a label and continue to run.
I figured this out reading the manuals however, I am not sure how "TimeFlag" works and if I used it correctly?VAR num MaxTime:=30;!This is the max time the robot will wait for a decision to ACCEPT the cutVAR bool TimeFlag := FALSE;WaitUntil Green_PB = 1 OR TimeFlag AND MaxTime >0;IF Green_PB = 1 THENGOTO CutHeightNotAccepted2;ELSEGOTO ACCEPTED2;ENDIF0 -
a little more explanation. If a person hits the green button, the robot will go to a label that ends the routine and go home and end the program. If the button is not hit after 30 seconds, the robot will goto another label and continue to process.0
-
Hi
Using the code Denis posted with the if statement and you should probably have a separate routine for each of the options so it become a procedure call not a GoTo:VAR bool bTimeFlag; VAR num nMaxTime:=30; ... WaitDI GreenButton, 1, \MaxTime:=nMaxTime \TimeFlag:=bTimeFlag \Visualize \Header:="Waiting for signal" \MsgArray:=["Movement will not start until", "the condition below is TRUE"] \Icon:=iconError; IF bTimeFlag=True Then rAccepted; ELSE rNotAccepted; ENDIF
0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings