phidget and spyder problem time

General PhidgetSBC Discussion.
Post Reply
nmadonia
Fresh meat
Posts: 4
Joined: Thu Feb 25, 2021 8:47 am
Contact:

phidget and spyder problem time

Post by nmadonia »

I encounter a problem with spyder in fact every time I start the script after a few minutes this message appears:

Code: Select all

runfile('C:/Phidget/Phidget_HUM1001_0_Python_Example/example.py', wdir='C:/Phidget/Phidget_HUM1001_0_Python_Example')
Traceback (most recent call last):

  File "C:\Phidget\Phidget_HUM1001_0_Python_Example\example.py", line 38, in <module>
    main()

  File "C:\Phidget\Phidget_HUM1001_0_Python_Example\example.py", line 29, in main
    humiditySensor0.openWaitForAttachment(20000)

  File "C:\Users\Nicol\anaconda3\lib\site-packages\phidget22-1.7.20210504-py3.8.egg\Phidget22\Phidget.py", line 574, in openWaitForAttachment
    raise PhidgetException(result)

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.
Make sure to enable server discovery, or add the server, and to set the server password if autentication is enabled.

My PhidgetSBC 4 is connected to my laptop with an eternet cat6 connection.

I tried to check the ports to which my Humidity sensor is attached. I read that it doesn't support two open windows and so I closed everything. I write the code (it is that of the example).

Code: Select all

from Phidget22.Phidget import *
from Phidget22.Net import *
from Phidget22.Devices.Log import *
from Phidget22.LogLevel import *
from Phidget22.Devices.HumiditySensor import *
import time

def onHumidityChange(self, humidity):
	print("Humidity: " + str(humidity))

def onError(self, code, description):
	print("Code: " + ErrorEventCode.getName(code))
	print("Description: " + str(description))
	print("----------")

def main():
	Log.enable(LogLevel.PHIDGET_LOG_INFO, "phidgetlog.log")
	Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE)

	humiditySensor0 = HumiditySensor()

	humiditySensor0.setHubPort(0)
	humiditySensor0.setIsRemote(True)
	humiditySensor0.setDeviceSerialNumber(592071)

	humiditySensor0.setOnHumidityChangeHandler(onHumidityChange)
	humiditySensor0.setOnErrorHandler(onError)

	humiditySensor0.openWaitForAttachment(20000)

	try:
		input("Press Enter to Stop\n")
	except (Exception, KeyboardInterrupt):
		pass

	humiditySensor0.close()

main()
I thank you in advance
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: phidget and spyder problem time

Post by mparadis »

There are a couple of reasons you could be getting a timeout error when calling openWaitForAttachment(). Ultimately it means it couldn't find the Phidget channel because:

- Incorrect matching parameters (e.g. wrong serial number)
- Insufficient power supply on the Phidget (often happens when many devices are on the same low-power USB hub)
- Channel is already open locally in another program or process (including Phidget Control Panel)
- When opening remotely, timeout will occur if the Network Server is not running on the computer the Phidget is connected to.

I would first see if you can get it to show up as a remote server in the Phidget control panel on your laptop. If that doesn't work then it's probably a problem with the Network Server or the network itself (e.g. client is on the wrong wifi network or router configuration is blocking traffic)
nmadonia
Fresh meat
Posts: 4
Joined: Thu Feb 25, 2021 8:47 am
Contact:

Re: phidget and spyder problem time

Post by nmadonia »

THANK YOU VERY MUCH.
You're always very kind. I have solved.
Nicolas
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests