mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2025-12-12 16:58:30 +00:00
Merge branch 'master' of https://github.com/romanlum/OBD.NET
This commit is contained in:
commit
d2c2b8456f
28
README.md
28
README.md
@ -45,7 +45,33 @@ class Program
|
||||
}
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
|
||||
//Async example
|
||||
MainAsync(comPort).Wait();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Async example using new RequestDataAsync
|
||||
/// </summary>
|
||||
/// <param name="comPort">The COM port.</param>
|
||||
/// <returns></returns>
|
||||
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<EngineRPM>();
|
||||
Console.WriteLine("Data: " + data.Rpm);
|
||||
data = await dev.RequestDataAsync<EngineRPM>();
|
||||
Console.WriteLine("Data: " + data.Rpm);
|
||||
var data2 = await dev.RequestDataAsync<VehicleSpeed>();
|
||||
Console.WriteLine("Data: " + data2.Speed);
|
||||
data = await dev.RequestDataAsync<EngineRPM>();
|
||||
Console.WriteLine("Data: " + data.Rpm);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user