In your setup routine you need to switch Wire on with the line:
wire.operate = cvOn
Ian
rtstofer wrote:
> --- 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
>
>
>
> ------------------------------------
>
>
[Non-text portions of this message have been removed]
------------------------------------
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