PhidgetInterfaceKit 8/8/8 1018_2

Technical Discussions on any InterfaceKits
Post Reply
sfergusson
Fresh meat
Posts: 1
Joined: Mon Aug 05, 2024 11:49 am
Contact:

PhidgetInterfaceKit 8/8/8 1018_2

Post by sfergusson »

I am using a older PhidgetInterfaceKit 8/8/8 1018_2. Using the Phidget22 library with C/C++ on a Windows 10 machine. When reading the digital inputs I call the function PhidgetDigitalInput_getState(). I expect a value of 0 returned when the input is LOW, and a 1 when the input is HIGH. However, occasionally I start getting a value of 2 returned by this function. I have had this happen both when the input is high and when it is low.

What would cause this to happen? What does a value of 2 signify, what state is it supposed to be?
jdecoux
Labview Developer
Posts: 180
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: PhidgetInterfaceKit 8/8/8 1018_2

Post by jdecoux »

A returned value of 2 from PhidgetDigitalInput_getState() is a signifier for "Unknown". This typically occurs if you try and poll the value too soon after opening the device, before it has a chance to report its actual state.

You can also check the return code [code = PhidgetDigitalInput_getState()], which in this case would give you "EPHIDGET_UNKNOWNVAL". In languages other than C, this would throw an exception, but users of C must be more vigilant.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests