Page 1 of 1

Sample project to connect MOT2002

Posted: Wed Jan 31, 2024 9:55 pm
by Peter Webb
Trying to connect to MOT2002 thru HUB00001, C# in VS2022

* In the Phidget control panel, works perfectly (using Voltage Input Mode and setting to generic voltage input or as MOT2002, or using Digital Input Mode) -> no problem with hardware
* Have HUM1001 and LUX100 connected to the same hub, those work perfectly with their sample programs -> no problem with libraries
* But using sample programs VoltageInput or DigitalInput I get "Attached: Nothing" -> problem!

Any help appreciated!

Re: Sample project to connect MOT2002

Posted: Thu Feb 01, 2024 11:07 am
by Patrick
The MOT2002 is an analog sensor, so you will need to set isHubPort to true before calling open in order to use the Voltage Input mode of the hub port.

On the MOT2002 product page, you can use the code sample generator to generate a sample project.

-Patrick

Re: Sample project to connect MOT2002

Posted: Thu Feb 01, 2024 7:21 pm
by Peter Webb
Thanks.

I tried something like this with no success. Will try again in a few days (away from my workbench for now), and post code if I can't make it work.

BTW, the MOT2002 page does not let you build a sample project, it directs you to the hub, where you have to work out the specifics for the device - which I failed at!

Re: Sample project to connect MOT2002

Posted: Fri Feb 02, 2024 1:37 pm
by jdecoux
There is a Code Samples tab on the MOT2002 page that allows you to select a programming language and the Hub you are connecting to, which will give you code specific to your use-case to get started.

https://www.phidgets.com/products.php?p ... de_Samples

Re: Sample project to connect MOT2002

Posted: Fri Feb 02, 2024 8:20 pm
by Peter Webb
I see the code samples page now.

Tried that, success, I see motion!

Thanks, looking forward to getting it working in my application.