как исправить ошибки модуля в snap7 - PullRequest
0 голосов
/ 03 мая 2019

Я пытаюсь установить связь между plc s7 1200 и rpi 3, я установил snap7, но при выполнении этого кода я получаю следующую ошибку:

нет модуля с именем snap7

Это мой код:

from time import sleep
import snap7
from snap7.util import *
import struct

plc = snap7.client.Client()
plc.connect("192.168.12.73",0,1)

area = 0x82    # area for Q memory
start = 0      # location we are going to start the read
length = 1     # length in bytes of the read
bit = 0        # which bit in the Q memory byte we are reading

byte = plc.read_area(area,0,start,length)
print "Q0.0:",get_bool(mbyte,0,bit)
plc.disconnect()
...