You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
await client.connect() # connect to device, reconnect automatically
152
152
await client.write_coil(1, True, device_id=1) # set information in device
153
-
result = await client.read_coils(2, 3, device_id=1) # get information from device
153
+
result = await client.read_coils(2, count=3, device_id=1) # get information from device
154
154
print(result.bits[0]) # use information
155
155
client.close() # Disconnect device
156
156
@@ -160,9 +160,9 @@ anything.
160
160
The line :mod:`await client.connect()` connects to the device (or comm port), if this cannot connect successfully within
161
161
the timeout it throws an exception. If connected successfully reconnecting later is handled automatically
162
162
163
-
The line :mod:`await client.write_coil(1, True, device_id=1)` is an example of a write request, set address 1 to True on device 1.
163
+
The line :mod:`await client.write_coil(1, [True], device_id=1)` is an example of a write request, set address 1 to True on device 1.
164
164
165
-
The line :mod:`result = await client.read_coils(2, 3, device_id=1)` is an example of a read request, get the value of address 2, 3 and 4 (count = 3) from device 1.
165
+
The line :mod:`result = await client.read_coils(2, count=3, device_id=1)` is an example of a read request, get the value of address 2, 3 and 4 (count = 3) from device 1.
166
166
167
167
The last line :mod:`client.close()` closes the connection and render the object inactive.
168
168
@@ -217,7 +217,7 @@ All simple request calls (mixin) return a unified result independent whether it
217
217
The application should evaluate the result generically::
0 commit comments