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

Pololu Forum

Maestro USB 6ch Servo Visual Basic

I can not get my servo to move in VB. I think I may be oversimplifying it.
when I hit button9 I would like to drive the servo to a specific point.

 Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        Dim SerialBytes(4) As Byte
        Dim Channel As Integer
        Channel = 0
        SerialBytes(0) = 170 ' Command Byte: Set Target.
        SerialBytes(1) = Channel ' First data Byte holds channel number.
        SerialBytes(2) = 112 ' Second Byte holds the lower 7 bits Of target.
        SerialBytes(3) = 46 ' Third data Byte holds the bits 7-13 Of target.data(0) = 132


        SerialPort4.PortName = "COM4"
        SerialPort4.Open()
        SerialPort4.Write(SerialBytes, 0, 4)
        SerialPort4.Close()
    End Sub

please let me know what I am doing wrong. The yellow light on the board blinks when I press the button, but nothing else happens.

Hello.

Your code looks fine. Are you able to move the servo using the Maestro Control Center? Does your program only send the servo to one commanded target position? If so, then the servo might simply already be at that position and does not need to move. Otherwise, can you send a screenshot of the Maestro Control Center showing the “Serial Settings” tab? Is COM4 listed as the Maestro’s Command Port in your Device Manager under the “Ports (COM & LPT)” list? Can you post a picture showing how everything is connected in your setup? What are you using to power your servo?

- Amanda

Amanda,
Thank you so much for your help. I realized when taking screen shots that my setting were wrong in the control center. The USB port is now set correctly and is functioning.

I’m glad you figured out the issue; thank you for letting me know!

- Amanda