Hey I just want to thank everyone who helped me out, my understanding of this program really improved because of it. Here is the functional code in case you are interested.
oServo Operation Code:
Dim servo1 As New oServo
Dim button1 As New oDIO1
Dim button2 As New oDIO1
Dim wire1 As New oWire
Dim wire2 As New oWire
Dim positionchange1 As New oEvent
Dim positionchange2 As New oEvent
Sub Main()
ooPic.delay = 250
servo1.IOLine = 31
servo1.Center = 21
servo1.Operate = cvTrue
servo1.Position = 21
button1.IOLine = 7
button1.Direction = cvInput
button2.IOLine = 6
button2.Direction = cvInput
wire1.Input.
wire1.Output1.
wire1.InvertIn = cvTrue
wire1.Operate = cvTrue
wire2.Input.
wire2.Output1.
wire2.InvertIn = cvTrue
wire2.Operate = cvTrue
End Sub
Sub positionchange1_
servo1.Position = 63
End Sub
Sub positionchange2_
servo1.Position = 0
End Sub
ooPIC Tech Support <dennis.clark@
DLC
carson hoyt wrote:
> So yeah I have no idea why but the button isn't working, is it the code or should I start checking I/O lines for damage? Here is the updated code.
>
> ooPIC.Delay = 500
>
> Dim servo1 As New oServo
> Dim button1 As New oDIO1
> Dim wire1 As New oWire
> Dim positionchange1 As New oEvent
>
> Sub Main()
>
> servo1.IOLine = 31
> servo1.Center = 21
> servo1.Operate = cvTrue
> servo1 = 21
>
> button1.IOLine = 8
> button1.Direction = cvInput
>
> wire1.Input.
> wire1.Output1.
>
> End Sub
>
> Sub positionchange1_
>
> servo1 = 50
>
> End Sub
>
> Andrew Porrett <slicerwizard@
> >Sub positionchange1_
> > > >
> > > > Do
> > > > servo1.Position = 35
> > > >
> > > > Loop
> > > > End Sub
> >
> > >An event handler that loops forever - so does your OOPic just lock up
> > >when it gets here? Why do you want to loop here?
> >Well I want the servo to maintain its position until another button
> >is pressed. I was going to have seperate events for each button.
>
> servo.position = x (or servo = x, IIRC) will move the servo to
> position x and the servo will maintain that position until you tell
> it to move to some other position, so the do loop serves no purpose.
>
> >How would you go about it?
>
> I'd take out the do loop.
>
> > This is the first program I have ever attempted to write so I'm
> > sure it sucks and everything.
>
> Sucks? Naw, you haven't seen some of the doozies that've graced this
> forum. :)
>
> > Am I at least using the right objects?
>
> Looks good to me. Add your other button(s) and event handler(s).
>
> ...Andy
>
>
>
>
>
>
> ------------
> Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
>
> [Non-text portions of this message have been removed]
>
>
>
>
> Yahoo! Groups Links
>
>
>
--
------------
Dennis Clark ooPIC Tech Support
www.oopic.com
------------
------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
[Non-text portions of this message have been removed]
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch format to Traditional
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
__,_._,___
No comments:
Post a Comment