Reading Maestro Inputs in VB.Net

I have been using two maestro boards (12 and 24) to successfully control a number of servos around a fairly large model railway system - using VB.Net to construct an overall control package. I successfully modified the examples to do what I needed with servos but would now like to use some ports as input from either reed switches or possibly hall sensors.

I cannot see any example code (in either VB or C+) to read sensors - please can you tell me if there are any examples of such code

Andy Whorton


You can read the status of Maestro channels using getVariables(), which you can find the definition of on line 567 in Usc.cs. Our Visual Basic and C++ examples do not use getVariables(), but you can use MaestroAdvancedExample (which is in C#) as a reference.


I have tried this but if I use the following code I just get Index Out Of Bounds Of Array

Any thoughts

''' Attempts to get the maestro variables
Sub TryGetVars(ByVal channel As Byte, ByVal target As UInt16)
    Dim st As Short()
        Using device As Usc = connectToDevice() ' Find a device and temporarily connect.
        End Using
    Catch exception As Exception  ' Handle exceptions by displaying them to the user.
    End Try
End Sub