At 06:23 PM 7/30/2007, jueysmum wrote:
>Hi
>In the following code, if I move the if construct outside of the
>event handling code, the robot will not stop. If I leave it in it
>will. I've done a few further experiments with the code for the
>value of counter - some will work outside the event handler, some
>won't why is this? Counter is a global variable so why the
>difference?
>
>Dim LeftServo as New oServoX
>Dim RightServo as New oServoX
>
>
>Dim CountAdd as New oEvent
>Dim Wire as New oWire
>Dim RightWire as New oWire
>Dim ScreamWire as New oWire
>
>Dim Scream as New oFreq
>
>Dim Counter as New oByte
>
>Sub Main()
>
> LeftServo.IOLine = 29
> RightServo.IOLine = 30
> RightServo.InvertOut = cvTrue
>
> LeftServo.Value = 127
> RightServo.Value = 127
>
> Counter.Value = 0
>
>
>LeftServo.Operate = cvTrue
>RightServo.Operate = cvTrue
>Wire.Input.Link(OOpic.hz1)
>Wire.Output.Link(CountAdd.operate)
>Wire.Operate = cvtrue
>Scream.Value = 61473
> End Sub
>
>sub CountAdd_CODE()
>Counter.inc
>Scream.operate = cvtrue
>Oopic.delay = 10
>Scream.operate = cvfalse
>if Counter.value >5 then
>RightServo.Operate= cvFalse
>LeftServo.Operate = cvFalse
>end if
>end sub
>
>Jueysmum
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment