This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Thursday, July 19, 2007

[oopic] oServo Operation Code

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.Link(button1)
wire1.Output1.Link(positionchange1.Operate)
wire1.InvertIn = cvTrue
wire1.Operate = cvTrue

wire2.Input.Link(button2)
wire2.Output1.Link(positionchange2.Operate)
wire2.InvertIn = cvTrue
wire2.Operate = cvTrue
End Sub

Sub positionchange1_Code()

servo1.Position = 63

End Sub

Sub positionchange2_Code()

servo1.Position = 0

End Sub

ooPIC Tech Support <dennis.clark@oopic.com> wrote: wire1.Operate = cvTrue : You have to turn processing objects on.

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.Link(button1)
> wire1.Output1.Link(positionchange1.Operate)
>
> End Sub
>
> Sub positionchange1_Code()
>
> servo1 = 50
>
> End Sub
>
> Andrew Porrett <slicerwizard@gmail.com> wrote: At 02:27 AM 7/19/2007, carson hoyt wrote:
> >Sub positionchange1_Code
> > > >
> > > > 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]

__._,_.___
Recent Activity
Visit Your Group
SPONSORED LINKS
Yahoo! News

Sexual Health

Get important

sex health news

Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Yahoo! Groups

Moderator Central

get help and provide

feedback on Groups.

.

__,_._,___

No comments: