This is an automated email from the ASF dual-hosted git repository.

git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/plc4x-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 28c98e6cb Site checkin for project PLC4X: Jenkins Tools
28c98e6cb is described below

commit 28c98e6cb611151e9c70a51957d38878eddb9462
Author: jenkins <bui...@apache.org>
AuthorDate: Fri May 10 14:33:24 2024 +0000

    Site checkin for project PLC4X: Jenkins Tools
---
 users/getting-started/plc4py.html | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/users/getting-started/plc4py.html 
b/users/getting-started/plc4py.html
index cde35a1f5..471277b8a 100644
--- a/users/getting-started/plc4py.html
+++ b/users/getting-started/plc4py.html
@@ -347,16 +347,29 @@ Once we have decided that PLC4Py is in a position to 
release we will publish to
 <pre>import asyncio
 from plc4py.PlcDriverManager import PlcDriverManager
 
-connection_string = "modbus://192.168.1.174:502"
+connection_string = "modbus://127.0.0.1:5020"
 driver_manager = PlcDriverManager()
 
 async def communicate_with_plc():
+    """
+    Asynchronously communicates with a PLC using a PlcDriverManager.
+
+    This function establishes a connection to the PLC defined by the 
connection_string.
+    It builds a read request for a specific item ("Random Tag" in this case) 
using the connection's read request builder.
+    The request is then executed asynchronously, and the response code is 
printed.
+    """
+    print(f"Connecting to plc: {connection_string}")
     async with driver_manager.connection(connection_string) as connection:
+        print(f"Connected to {connection_string}")
         with connection.read_request_builder() as builder:
+            print(f"Building read request")
             builder.add_item("Random Tag", "4x00001[10]")
             request = builder.build()
-
-        response = await connection.execute(request)
+            print(f"Request built")
+            print(f"Executing request")
+            response = await connection.execute(request)
+            print(f"Request executed")
+            print(f"Response code: {response.response_code}")
 
 asyncio.run(communicate_with_plc())</pre>
 </div>

Reply via email to