I am using a VINT HUB0002_0, I have a STC1005_0 connected to port 0 and it attaches fine. The I am trying to configure port 1 for digital input. It fails at openWaitForAttachment with a timeout error. I intend to connect a limit switch to it. Here is the code:
// Continue with Forward limit switch on channel 1
RetCode = PhidgetDigitalInput_create(&FrwdLmt);
RetCode = Phidget_setHubPort((PhidgetHandle)FrwdLmt, 1);
// Can assign event handlers here
RetCode = Phidget_openWaitForAttachment((PhidgetHandle)FrwdLmt,
PHIDGET_TIMEOUT_DEFAULT);
if (RetCode != EPHIDGET_OK) {
MessageBox(NULL, "Cannot attach Forward Limit Channel",
"Phidget interface initialization", MB_OK);
return FALSE;
}
In addition to setting the hub port index, you also need to set IsHubPortDevice to 1, otherwise the software will be looking for an actual Phidget device with a digitalInput channel, rather than opening the port itself as a Digital Input.