Comments (7)
Fernando, my pylogix version is 0.8.14. i also have pylogix2 installed which is version 0.5.3. Assume I'm using pylogix and not pylogix2
if you are running your script and calling lower case value
then you're running pylogix2 which we are not affiliated with nor support. I suggest you uninstall pylogix2 it was a rogue fork.
Also forgot to mention you might want to add a sleep in your while loop to prevent high cpu usage.
from pylogix.
In your example ret
is a list of Response objects. So, you'll need to return ret
, then iterate again outside the run_script function just like you did inside the function.
def run_script():
with PLC() as comm:
comm.IPAddress = 'xx.xx.xx.xx'
ret = comm.Read(list)
for r in ret:
print(r.Value)
return ret
while True:
y = run_script()
for r in y:
print(r.Value)
Alternatively, you can create a new integer list:
def run_script():
int_ret = []
with PLC() as comm:
comm.IPAddress = 'xx.xx.xx.xx'
ret = comm.Read(list)
for r in ret:
print(r.Value)
int_ret.append(r.Value)
return int_ret
while True:
y = run_script()
print(y)
Also note that this library Response object is upper case Value, not value. You might be using the wrong package. What's your pylogix version?
from pylogix.
Fernando, my pylogix version is 0.8.14. i also have pylogix2 installed which is version 0.5.3. Assume I'm using pylogix and not pylogix2
from pylogix.
Hi, Fernando. Thank you :) I've uninstalled pylogix2 and added a 5 sec sleep. Just one last thing - r.value as mentioned by yourself is a list of response objects. How do I store this list as a row of integer values e.g. [50, 10, 25, 22].
from pylogix.
I might use the append method.
from pylogix.
Fernando, the append function seems to work. Thank you again for getting me on track with my issue :)
from pylogix.
Fernando, the append function seems to work. Thank you again for getting me on track with my issue :)
Glad to be able to help.
from pylogix.
Related Issues (20)
- "Forward open failed" when trying to read tags from Berghof PLC HOT 8
- .GetDeviceProperties always returns DeviceType of "None" HOT 5
- Issues connecting to emulate HOT 7
- micro850 connection HOT 5
- Return data gets jumbled up on a multi write when the tags don't exist. HOT 13
- The return value is different when using a multi write compared to a single write for a string. HOT 4
- cannot get a tag list HOT 3
- Is it possible to inhibit a periodic task? HOT 2
- PLC REAL values HOT 5
- Pylogix - compare a previously acquired tag list with the current one HOT 5
- Discover does not work while running pylogix in docker HOT 10
- Invalid Continuation Byte HOT 5
- Abnormal code termination. HOT 8
- Do I need to use routing? HOT 20
- PLC connection best practice HOT 8
- Forward Open Failed HOT 22
- Connection Issues HOT 9
- PLC read does not run when called from a function HOT 5
- documentation on the CIP protocol HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylogix.