Hub5000 - visible on control panel, unable to find through program

General PhidgetSBC Discussion.
Post Reply
Mattf
Fresh meat
Posts: 2
Joined: Thu Apr 30, 2020 4:26 pm
Contact:

Hub5000 - visible on control panel, unable to find through program

Post by Mattf »

Hi,

Really basic (bad) programming skills...

I have a series of usb hub devices working, and I'm trying to add a wireless vint to the system for some remote data collection.

After updating the firmware, the control panel can find the device, and I'm able to access the spatial MOT1102_0 that is attached.

However, I can not seem to have it discovered in my program.

Python running in pycharm 2020.01 in windows


little bits of the code:

def main():
Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE)

ch8 = Accelerometer()

i=0

def AccelerationChangeHandlerI(self, acceleration, timestamp):
global i
i = acceleration

ch8.setOnAccelerationChangeHandler(AccelerationChangeHandlerI)
ch8.openWaitForAttachment(20000)
ch8.setHubPort(0)
ch8.setChannel(0)
ch8.setIsRemote(True)
ch8.setDataInterval(20)
ch8.setDeviceSerialNumber(596579)


And the error message:

File "C:xx", line 135, in <module>
ch8.openWaitForAttachment(20000)
File "C:xx", line 561, in openWaitForAttachment
raise PhidgetException(result)
Phidget22.PhidgetException.PhidgetException: PhidgetException 0x03 (Timed Out)
No matching devices were found to open. Make sure your device is attached, and that your addressing parameters are specified correctly. If your Phidget has a plug or terminal block for external power, ensure it is plugged in and powered.


I'm sure it's user error... ;)
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Hub5000 - visible on control panel, unable to find through program

Post by mparadis »

You should set the addressing parameters (HubPort, Channel, DeviceSerialNumber, IsRemote) before calling openWaitForAttachment, so your program knows which channel to look for. If these parameters are not set before opening, it will just try to find any local Accelerometer channel it can find. Since your channel is remote, it couldn't find it this way. If you set the addressing parameters before open, it should be able to locate the channel.

setDataInterval still needs to be called after- preferably in the attach handler so you know the device is attached and ready to have its properties changed.
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Hub5000 - visible on control panel, unable to find through program

Post by Patrick »

Actually, if you don't set either isLocal or isRemote to true, the library will match equally against local or remote channels. I would expect this program to work properly without specifying ANY addressing parameters, and if that MOT0110 is the only Accelerometer you'll ever have on your network, then it's perfectly fine to not specify any addressing parameters.

Maybe, enable logging in the library? Make sure your python library is up to date, as well at the HUB5000 firmware.

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests