Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Programming Serial Servo Controller in Visual Basic .NET


#1

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


#2

You might find this thread helpful.

Good luck!

-Adam


#3

Thanks thats been really helpful!