dmroeder / pylogix

Read/Write data from Allen Bradley Compact/Control Logix PLC's
Apache License 2.0
598 stars 182 forks source link

Write to Micro850 #163

Closed dpatel2016 closed 3 years ago

dpatel2016 commented 3 years ago

It's not writing to the PLC consistently. Sometimes it works, and sometimes you need to send the signal twice to write it. How do I fix this? I am using Micro850 and the variable is Boolean. I am only writing 0 or 1.

dmroeder commented 3 years ago

I see you closed it, could I ask what was happening?

dpatel2016 commented 3 years ago

I have micrologix and micro850 PLCs so I mainly use node red and mqtt to python to control M850s. In the python code, I was subscribing and based on the msg, writing to M850. It was not working because the pylogix code was outside the on_connect part of mqtt. I had to press button twice on node red to write it not sure why, but after moving the pylogix code to inside mqtt function, it started working as expected.

dmroeder commented 3 years ago

Okay, thanks for the details.