mirror of
https://github.com/DarthAffe/OBD.NET.git
synced 2025-12-13 01:08:30 +00:00
Merge branch 'master' of https://github.com/romanlum/OBD.NET
This commit is contained in:
commit
d2c2b8456f
26
README.md
26
README.md
@ -46,6 +46,32 @@ class Program
|
|||||||
Console.ReadLine();
|
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