Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for some direction with a python project

Status
Not open for further replies.

BJZeak

Programmer
May 3, 2008
230
CA
Have Python source code in Unix that runs automatically from rc.local at startup which continually
- monitors several Analog and Digital inputs
- displays any changes based on these inputs

Looking to make a rudimentary external CLI interface that would provide virtual inputs in parallel with the existing inputs

Basically using a Unix Shell Scripts I am wanting to do something like:
Code:
Description                              Shell Script            Python
read current value of Input 1            Digital 1               get current value of Digital 1 
override current value of Input 1        Digital 1 On            override Digital 1 Value
override current value of Input 1        Digital 1 Off           override Digital 1 Value
read current value of Input A            Analog A                get current value of Analog A
override current value of Input A        Analog A 100            override current value of Analog A
override current value of Input A        Analog A 0              override current value of Analog A

Not sure if there is any way to interact and or interchange data directly with a running program due to scoping and OS protections

The simplest way would be to just change a text file and have the main program read the values looking for any changes ... windows internally uses messaging to pass in and out data to/from other running processes ... briefly looked over Threading in Python and wondering if it might have some mechanism that might provide some way to interchange/share data?

Basically I am expecting the Main Process needs to have a TRUE set of Global/Shared variables such that both the running and an external program can affect the values

The Main logic would then monitor both the real input and the virtual input and update the display for the input that changed

Thoughts?
 
First check if you can talk to the program started by rc.local. Just a simple TCP or UDP socket - don't bother with pipes: too much trouble to get them working. You may have to set sticky bits.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top