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.

Sunday, July 20, 2008

[oopic] Re: control servo via serialport

Try this:
If SP.Received = cvTrue Then
i.Value = SP.Value
SP.Value = i.Value
SR.Speed = i.Value
End If
The problem is that you will not have any data in the SP.Value
buffer because you have already pulled it out.

--- In oopic@yahoogroups.com, "Angelo" <mowens18@...> wrote:
>
> I'm trying to control a servo using data coming from the
serialport.
> The code is as follows:
> ***********************************
> Dim SR As New oServoSP
> Dim SP As New oSerialH
> Dim i As New oWord
>
> Sub Main()
> ooPIC.Delay = 4000
> SR.IOLine = 30
> SR.Operate =cvTrue
> SP.Baud = cv9600
> SP.Operate = cvTrue
> SR = 0
> Do
> If SP.Received = cvTrue Then
> i.Value = SP.Value
> SP.Value = i.Value
> SR.Speed = SP.Value
> End If
> Loop
> End Sub
> *********************************
>
> The problem is that the servo does not move coresponding to the
> correct value sent to the serial port.
>
> How do you convert the incoming ascii data into a string that can
be
> used to control the servo?
>
> Please help!
>
> Regards,
> Angelo
>

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

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: