Page 2 of 2

Re: Timed out and 2 parallels scripts

Posted: Sat Feb 03, 2018 8:52 am
by DSX
I'm still tyring but nothing...

No more ideas ?

Thanks

Re: Timed out and 2 parallels scripts

Posted: Mon Feb 05, 2018 4:03 pm
by Patrick
Try increasing the timeout in phidgetadmin

Re: Timed out and 2 parallels scripts

Posted: Fri Mar 16, 2018 3:17 am
by DSX
I've made many tries and here is the informations I have :
phidget22networkserver -D returns

Code: Select all

INFO [netsrv][2018-03-16T10:02:45 server.c+305 main()]: Phidget22NetworkServer 1.1
phidget22admin -R -L -d returns

Code: Select all

(136263) PhidgetInterfaceKit 0/16/16
         (136263/0/0) Digital Input
         (136263/0/1) Digital Input
         (136263/0/2) Digital Input
         (136263/0/3) Digital Input
         (136263/0/4) Digital Input
         (136263/0/5) Digital Input
         (136263/0/6) Digital Input
         (136263/0/7) Digital Input
         (136263/0/8) Digital Input
         (136263/0/9) Digital Input
         (136263/0/10) Digital Input
         (136263/0/11) Digital Input
         (136263/0/12) Digital Input
         (136263/0/13) Digital Input
         (136263/0/14) Digital Input
         (136263/0/15) Digital Input
         (136263/0/0) Digital Output
         (136263/0/1) Digital Output
         (136263/0/2) Digital Output
         (136263/0/3) Digital Output
         (136263/0/4) Digital Output
         (136263/0/5) Digital Output
         (136263/0/6) Digital Output
         (136263/0/7) Digital Output
         (136263/0/8) Digital Output
         (136263/0/9) Digital Output
         (136263/0/10) Digital Output
         (136263/0/11) Digital Output
         (136263/0/12) Digital Output
         (136263/0/13) Digital Output
         (136263/0/14) Digital Output
         (136263/0/15) Digital Output
but the without -L it returns nothing.

I think now my server is launched, here is my script :

Code: Select all

#!/usr/bin/python

import sys
import time 
import mysql.connector
from Phidget22.Devices.DigitalInput import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
from Phidget22.Net import *

def StateChangeHandler(e, state):
	print("Channel %d : %f" % (e.getChannel(), state))

def ErrorEvent(e, eCode, description):
	print("Error %i : %s" % (eCode, description))

try:
	print('debut')
	Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE)
	Net.addServer('Phidget22 Server', '192.168.0.11', 5661, '', 0)
	print('add')
	
	ch0 = DigitalInput()
	ch0.setOnStateChangeHandler(StateChangeHandler)
	ch0.setOnErrorHandler(ErrorEvent)
	ch0.setDeviceSerialNumber(136263)
	ch0.setChannel(0)
	ch0.setIsRemote(1)
	ch0.open()

except PhidgetException as e:
	print("Runtime Exception %s" % e.details)
	print("Press Enter to Exit...\n")
	readin = sys.stdin.read(1)
	exit(1)

while 1:
	time.sleep(10)

exit(0)
And it does nothing...
I know about the infinite loop, but wihtout it, the scripts stops.

Please tell me if you have any idea. Thank you in advance.
Regards

Re: Timed out and 2 parallels scripts

Posted: Fri Mar 16, 2018 11:14 am
by Patrick
Try removing the enableServerDiscovery line - you don't need this and addServer.

If your running the script on the same machine as the server, use 'localhost' instead of the IP address in the addServer line.

Replace open with openWaitForAttachement and a timeout - try 5000ms. If this still doesn't connect, enable logging in your Python program, and see if there are any errors. Also, have a look at the network server log after trying to connect - there should be some incoming connection messages.

-Patrick

Re: Timed out and 2 parallels scripts

Posted: Thu Mar 22, 2018 12:13 pm
by DSX
Really thank you, it works !

Finally I can watch 8 inputs and activate outputs at the same time.