Sign in

username:

password:



Not a member?

Search oopic



Search tips

Subscribe to oopic



Ads

Discussion Groups

Discussion Groups | | control servo via serialport

control servo via serialport - Angelo - Jul 19 13:40:45 2008

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
------------------------------------



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )


Re: control servo via serialport - tinslwc - Jul 20 21:47:30 2008

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 o...@yahoogroups.com, "Angelo" 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
>

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



(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )