Reading a Servo Motor's ServoType

Supporting Visual Studio on Windows
jgrunschel

Reading a Servo Motor's ServoType

Postby jgrunschel » Wed Jan 06, 2010 7:56 pm

Hello,

I just got some Phidgets to tinker with. I'm using VB .NET, and have been playing with the corresponding sample code files. I was wondering if there was a way to read the type of servo motor that is attached to the servo control board. I've tried the following code, but it only returns the "DEFAULT" enum.

Code: Select all

Private Sub servo_Attach(ByVal sender As Object, ByVal e As Phidgets.Events.AttachEventArgs) Handles phidgetServo.Attach
    Dim oServo As Phidgets.Servo = sender

    With oServo.servos(0)
        MsgBox(.Type.ToString)
    End With
End Sub


Currently, I only have one servo. So, as a workaround, I've just hard-coded the servo type using the following code inside the "With" statement:

Code: Select all

.Type = Phidgets.ServoServo.ServoType.HITEC_HS322HD


It works fine for my tinkering. I just don't like hard-coding things like that.

Thanks,
Jeff

fraser
Engineering
Posts: 239
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Reading a Servo Motor's ServoType

Postby fraser » Thu Jan 07, 2010 10:15 am

You will have to hardcode it like you did since the servo controller has no way of knowing what type of servo you are using. The servo motor itself is not capable of communicating this information to the controller.

Fraser


Return to “VB .NET”

Who is online

Users browsing this forum: No registered users and 1 guest