From 0cabc384080dcaa2406d52ed39b197471833d4aa Mon Sep 17 00:00:00 2001
From: Felix Agner <felix.agner@control.lth.se>
Date: Tue, 3 Jan 2023 16:08:11 +0100
Subject: [PATCH] update readme

---
 README.md | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 37d4c79..a8188cd 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Pkg.add("https://gitlab.control.lth.se/processes/omnibot/omnibot.jl")
 ## Usage
 
 ### Code
-Use `connectomnibot` to create a TCP-connection. Whenever your script is done or you catch an error, close the connection with `close`.
+Use `connectomnibot` to create a TCP-connection. Whenever your script is done or you catch an error, close the connection with `close`. You can achieve the same result using `do x` syntax.
 
 #### Example: Make the robot go in a circle and print all available coordinates
 ```
@@ -46,6 +46,27 @@ println(getmaxspeed(bot))
 close(bot)
 ```
 
+### Example: `do x` syntax
+The following example does practically the same as the first example.
+```
+using Omnibot
+
+host = ...
+port = ...
+connectomnibot(host, port) do
+
+    for i = 1:100
+        setspeeds(bot,[100,100,100])
+        println("x:"*getx(bot))
+        println("y:"*gety(bot))
+        println("z:"*getz(bot))
+        println("theta:"*gettheta(bot))
+        sleep(0.1)
+    end
+
+end
+```
+
 ### Network
 At the department of automatic control, you should be connected to the omnibots via the same router. Currently this has been done with the router with name *robotlab*. IP and port conventions: Robot with name *omniX* has IP `192.168.0.10X` and port `900X` e.g.. omnibot `omni10` has IP `192.168.0.110`and port `9006`.
 
-- 
GitLab