Page 1 of 1

Open() Invalid Argument

Posted: Mon Jun 04, 2018 8:31 am
by Starwalker298
I'm attempting to create a class that enables pressure sensing using the Phidgets Interface Kit and a few different pressure sensors.

When I go to open the channel, I keep getting the error: Invalid Argument

Code: Select all

prc = Phidget_openWaitForAttachment((PhidgetHandle)sensors[0].ch, 5000);
         if (prc != 0)
            std::cout << prc << std::endl;
            fprintf(stderr, "Runtime Error -> Attachment Failed: \n\t");

What are some of the things that could make the opening invalid? The Voltage Ratio Input Example works, however I'm not sure what could be missing to cause this error. I don't get any errors when setting the parameters. I've attached my .cpp as it's a bit big to show inline.

Any help would be greatly appreciated :D
(11.2 KiB) Downloaded 48 times

Re: Open() Invalid Argument

Posted: Tue Jun 05, 2018 5:09 am
by Starwalker298
Solved it. Apparently attempting to create the channel handle using:

Code: Select all

this->prc = PhidgetVoltageRatioInput_create(&this->ch);
doesn't actually work if it is placed in the constructor. Moved it out to a different class member and it works a treat.

I would be grateful if someone could shed some light on this, as running functions in a constructor is usually quite alright.