Tuesday, July 15, 2008

[oopic] Help with OO code

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


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

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:

Post a Comment