Page 1 of 1

Unity does not attach sensor

Posted: Wed Jul 10, 2024 1:39 pm
by Muha
Hello,
I am using a PhidgetSBC4 (SBC3003_0).
I need the voltage inputs.
When I check the device in the phidgets control manager everything works fine.
However, when I try to access the channels in Unity through C# the Phidget does not attach the sensor.
I have found two solutions, one from the code creator from this site and the other solution somewhere in the internet.
First solution is:

myValue = new VoltageInput();
myValue.InHubPortDevice = true;
myValue.HubPort = 0;
myValue.Open();

the other solution is:

myValue = new VoltageInput();
myValue.Channel = 0;
myValue.Open();

When I try to access the channel with for example myValue.Voltage it will throw an error. When I check for myValue.Attached it will returne "false".

What do I miss here? How do I attach the channel?
How do I check if Unity has found the device?

I use Unity 2022.2.16f1.
I have installed the Phidgets DLL from the install file (the one that is for Net 4.0). Maybe I need an other DLL?

Any help would be highly appreciated as I have a hard deadline and I need to solve this problem.

Best Regards,
Muha

Re: Unity does not attach sensor

Posted: Tue Jul 16, 2024 1:09 pm
by jdecoux
Unless Unity is running on the SBC itself (unlikely), you will need to add a network connection to your program.

The easiest way to get code for this is to click the "Remote (Network)" box in the code generator. Then you can also (optionally) add the IP address or hostname in the box that will appear at the top of the sample generator beside the one for Serial Number.

Re: Unity does not attach sensor

Posted: Wed Sep 04, 2024 6:16 am
by Muha
Hello,
I have tested this solution and it works.
Thank you very much and sorry for my late response.