Unity does not attach sensor

Supporting Visual Studio on Windows
Post Reply
Muha
Fresh meat
Posts: 2
Joined: Wed Jul 10, 2024 1:24 pm
Contact:

Unity does not attach sensor

Post 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
jdecoux
Labview Developer
Posts: 180
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Unity does not attach sensor

Post 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.
Muha
Fresh meat
Posts: 2
Joined: Wed Jul 10, 2024 1:24 pm
Contact:

Re: Unity does not attach sensor

Post by Muha »

Hello,
I have tested this solution and it works.
Thank you very much and sorry for my late response.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests