我在GitHub上发现了pylogix,并在abl71 CPU上玩读/写标签。我在读/写部分是成功的,但我想做的是根据大于0的plc值触发一个GPIO引脚输出。在
我似乎不知道需要做些什么才能将不断更新的值输入到输出函数中。在
import threading
from pylogix.eip import PLC
from gpiozero import LED
from time import sleep
comm = PLC()
comm.IPAddress = '10.201.191.177'
def readdata():
threading.Timer(1.0, readdata).start()
x = comm.Read('parts')
print (x)
readdata()
if x > 0:
relay = LED(2)
很高兴在这个论坛上我不是唯一对PLC感兴趣的人。我建议您:
编辑: 我读了你们模块的文档。请尝试下面的新代码 可以找到文档https://gpiozero.readthedocs.io/en/stable/
相关问题 更多 >
编程相关推荐