loading
 
some sort of PWM
arindam  [8 posts]
9 years
hey, i donot know if this is the right place to ask this but i am stuck at a problem.
  i am sending a value out through your PARALLEL port module.
  and i wish to implement some sort of PWM(pulse width modulation).
very siply i wish to set a value
  
SetVariable "data", 2
  sleep for a while
then

' SetVariable "data", 4
    in vb script followed by a Parallel port modulue.. but am unable to implement the sleep function
please hel me out..
Anonymous 9 years
AK,

You can't really sleep in the VBScript module as that would stop processing. As the pipeline is essentially an infinite loop (i.e. grab an image, process it, then grab another, etc) adding a sleep would cease all execution which is usually not desired. So instead you can use the SetTimedVariable to cause the variable to change value after X number of milliseconds. Your script would look something like:

period = 2000

step = GetVariable("step")
if step = 0 then
  SetVariable "data", 2
  SetVariable "step", 1
  SetTimedVariable "step", 2, period
else
if step = 2 then
   SetVariable "data", 4
   SetVariable "step", 3
   SetTimedVariable "step", 0, period
end if
end if

which would case data to oscillate between 2 and 4 with a period of 2000 seconds. Note that usage of step and setting it to 1 and 3 which are dummy steps where nothing is done.

STeven.

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