Programming Serial Servo Controller in Visual Basic .NET

Hi everyone, I am trying to develop an application to control a Micro Servo Serial Controller from visual basic. I’ve got some of the basic commands working (servo speed and 7 bit position) but I am having a lot of trouble working out how to program the 8 bit position and absolute commands.

The code I have for set speed and 7 bit position is as follows:

Private Sub servospeed(ByVal servo As Integer, ByVal speed As Integer)

        'Set servo speed (1=slowest, 127=fastest, 0=No Limiting)

        Dim buffer As Byte() = {128, 1, 1, CByte(servo), CByte(speed)}
        SerialPort1.Write(buffer, 0, 5)

End Sub
Private Sub servoposition7(ByVal servo As Integer, ByVal position As Integer)

        'Set servo position (0 to 180)

        Dim buffer As Byte() = {128, 1, 2, CByte(servo), CByte(position)}
        SerialPort1.Write(buffer, 0, 5)

End Sub

These are the easier commands as they have only 1 data byte. I am struggling to figure out how to develop the 2 data bytes for the 8bit and absolute commands, any help would really be appreciated.

Thanks

You might find this thread helpful.

Good luck!

-Adam

Thanks thats been really helpful!