Skip to content

Commit b5ff3d7

Browse files
authored
Fix example (#452)
* Add missing import * Fix missing variables
1 parent a34b8fd commit b5ff3d7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

example/boolean.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535

3636

3737
# play with these functions.
38-
plc.read_area(areas['MK'], dbnumber, start, size)
39-
plc.write_area(areas['MK'], dbnumber, start, size)
38+
plc.read_area(area=areas['MK'], dbnumber=0, start=20, size=2)
39+
40+
data = bytearray()
41+
snap7.util.set_int(data, 0, 127)
42+
plc.write_area(area=areas['MK'], dbnumber=0, start=20, data=data)
4043
# read the client source code!
4144
# and official snap7 documentation

example/read_multi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import snap7
1010
from snap7.common import check_error
1111
from snap7.types import S7DataItem, S7AreaDB, S7WLByte
12+
from snap7 import util
1213

1314
client = snap7.client.Client()
1415
client.connect('10.100.5.2', 0, 2)

0 commit comments

Comments
 (0)