You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by ot...@apache.org on 2024/03/04 08:20:39 UTC
(plc4x) branch develop updated: Fix PLC4Py Gettingstarted example
This is an automated email from the ASF dual-hosted git repository.
otluk pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 504604e6fd Fix PLC4Py Gettingstarted example
504604e6fd is described below
commit 504604e6fd15ed29869c974a531e71b155c54b7f
Author: otluk <19...@users.noreply.github.com>
AuthorDate: Mon Mar 4 09:20:35 2024 +0100
Fix PLC4Py Gettingstarted example
---
src/site/asciidoc/users/getting-started/plc4py.adoc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/site/asciidoc/users/getting-started/plc4py.adoc b/src/site/asciidoc/users/getting-started/plc4py.adoc
index 7a42090aeb..2a6e04d92d 100644
--- a/src/site/asciidoc/users/getting-started/plc4py.adoc
+++ b/src/site/asciidoc/users/getting-started/plc4py.adoc
@@ -34,13 +34,14 @@ You now should be able to use PLC4Py in your application. A minimal example is s
----
from plc4py.PlcDriverManager import PlcDriverManager
-connection_string: = "modbus://192.168.1.174:502";
+connection_string = "modbus://192.168.1.174:502";
driver_manager = PlcDriverManager()
-async with driver_manager.connection(connection_string) as connection:
- with connection.read_request_builder() as builder:
- builder.add_item("Random Tag", "4x00001[10]")
- request = builder.build()
+async def communicate_with_plc():
+ async with driver_manager.connection(connection_string) as connection:
+ with connection.read_request_builder() as builder:
+ builder.add_item("Random Tag", "4x00001[10]")
+ request = builder.build()
future = connection.execute(request)
await future