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); + + } } } ```