Page 1 of 1

How do I open a digital output with a Python script and leave it open?

Posted: Fri Dec 04, 2020 6:27 am
by Mastiff
I have tried modyfying the example script, but whatever I do, a python script will close the open port again when I exit it. Can somebody please tell me the code for opening and closing a port and leave it open? Either on a local script or adressing the server, which is running.

Re: How do I open a digital output with a Python script and leave it open?

Posted: Fri Dec 04, 2020 4:01 pm
by mparadis
I'm not sure what you're asking- a program needs to call open so it knows what channel it's controlling.

Do you mean leave the channel available to be opened by the next program? Because that should be the case once the first program has finished.

If you're asking why the state of the output goes back to false when the channel closes, see this thread.

Re: How do I open a digital output with a Python script and leave it open?

Posted: Sat Dec 05, 2020 11:17 am
by Mastiff
I mean sending a command that has for instance output 2 sending 12V- through until I turn it off again. I thought that was what the Phidgets server should enable? So that keeps current flowing until a restart of the server or until the port is actively turned off by something else? If there's a Python code that tells the server to keep open a port, then that's what I am looking for.

Re: How do I open a digital output with a Python script and leave it open?

Posted: Mon Dec 07, 2020 1:57 am
by Mastiff
Fixed. I got help to make a persistent Phyton script that's called from Node-RED and opens and closes the nodes. OK, somebody made it for me, I didn't do much myself... :mrgreen: