Pause Function in VbScript
Alec from Canada  [1 posts]
8 years
Hey I am wondering if anyone knows how to pause using VbScript? I need to pause between servo movements using Sparkfun Arduino and Vbscript module.. I have tried some of the " WScript.Sleep(intTime)  " function with no success, I don't think that the correct library is included? Is there any way to add this library or anyone know another way to include a pause? THanks.
Anonymous 8 years

You can use the Sleep(milliseconds) function that was added to the VBScript module BUT this is most likely NOT want you want to do. When you use this command you will put all of RR to Sleep for that amount of time ... in other words the video will stop.

Instead you should add a form of state to your VBScript module to delay changing of the value until needed. Following is a quick example of how to do that delay.

state = GetVariable("state")

if state = 0 then
  SetVariable "servo_motor", 255
  SetVariable "state", 1
  SetTimedVariable "state", 2, 5000
elseif state = 2 then
  SetVariable "servo_motor", 128
end if

which will set the servo to 255, wait for 5 seconds and then set it back to 128 while still executing any other module within RR. This type of programming is known as a state machine.

Note that state 1 is a do nothing step with the timed variable function changing back to a valid step 2 after 5000 milliseconds.

Hope this makes sense.


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index