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.

Tuesday, July 15, 2008

[oopic] Re: Help with OO code

--- In oopic@yahoogroups.com, "Mike Martin" <xaviour2me@...> wrote:
>
> Would anyone be kind enough to tell me where I'm going wrong here
> please? I'm trying to write OO code to link a potentiometer to a
> servo to make it change its position. I can do it with procedural
> code OK but don't know what object to use in order to make it work
> with OO. Info about linking is a little thin - I need a link to a
> really good explaination to read about objects, pointers and flags if
> any has one?
> TIA
> Mike M.
>
> 'Positions a servo using the .position of an
> 'oKnob Object (trim pot)
> Dim Srv As New oServo 'Make a servo object.
> Dim Pot As New oKnob 'Make a knob object
> Dim Wire As New oWire
>
> Sub main()
> ooPIC.Node = 1
> Call Setup
> End Sub
>
> Sub Setup() 'Setup servo properties
> Srv.IOLine = 31 'set the servo to use I/O Line 31
> Srv.Adjust = 28 'set the servos center to 28
> Srv.Operate =cvTrue 'turn the Servo on
> Pot.IOLine = 1 'IOLine 1, pin 7
> Pot.Operate = cvTrue 'turn on IOLine 1
> Wire.Input.Link(Pot.Value)
> Wire.Output.Link(Srv.Position)
> End Sub
>

I know I have made this work before but I'm not on the Windows box at
the moment.

We know the oKnob will output 0..255 but oKnobX will output -128..127.
We also know that oServoX operates with signed values of -64..63 but
will accept -128..127.

So, why not try oKnobX and oServoX?

Richard

------------------------------------

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:

http://docs.yahoo.com/info/terms/

No comments: