From b1f1b8589e8cc35260f2a3d5d836c038500c7556 Mon Sep 17 00:00:00 2001 From: Roman Lumetsberger Date: Sat, 20 May 2017 18:11:15 +0200 Subject: [PATCH] Update README.md --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4ca9438..c80138e 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,33 @@ class Program } Console.ReadLine(); } - + + //Async example + MainAsync(comPort).Wait(); + + } + + /// + /// Async example using new RequestDataAsync + /// + /// The COM port. + /// + public static async Task MainAsync(string comPort) + { + using (SerialConnection connection = new SerialConnection(comPort)) + using (ELM327 dev = new ELM327(connection, new OBDConsoleLogger(OBDLogLevel.Debug))) + { + dev.Initialize(); + var data = await dev.RequestDataAsync(); + Console.WriteLine("Data: " + data.Rpm); + data = await dev.RequestDataAsync(); + Console.WriteLine("Data: " + data.Rpm); + var data2 = await dev.RequestDataAsync(); + Console.WriteLine("Data: " + data2.Speed); + data = await dev.RequestDataAsync(); + Console.WriteLine("Data: " + data.Rpm); + + } } } ```