update README
This commit is contained in:
parent
6426fc7afc
commit
203cc6b9fb
11
README.md
11
README.md
|
@ -9,13 +9,20 @@ vehicle.
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```rs
|
```rs
|
||||||
use obd2::{commands::Obd2DataRetrieval, device::Elm327, Obd2};
|
use obd2::{commands::Obd2DataRetrieval, device::{Elm327, FTDIDevice}, Obd2};
|
||||||
|
|
||||||
fn main() -> Result<(), obd2::Error> {
|
fn main() -> Result<(), obd2::Error> {
|
||||||
let mut device = Obd2::<Elm327>::default();
|
let mut device = Obd2::<Elm327::<FTDIDevice>>::new(Elm327::new(FTDIDevice::new()?)?)?;
|
||||||
println!("VIN: {}", device.get_vin()?);
|
println!("VIN: {}", device.get_vin()?);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
alternatively, you could use a serial port provided by your operating system such as
|
||||||
|
/dev/ttyUSB0 on unix-like systems
|
||||||
|
|
||||||
|
```
|
||||||
|
let mut device = Obd2::<Elm327::<SerialPort>>::new(Elm327::new(SerialPort::new("/dev/ttyUSB0")?)?)?;
|
||||||
|
```
|
||||||
|
|
||||||
See the docs for more: https://docs.rs/obd2/
|
See the docs for more: https://docs.rs/obd2/
|
||||||
|
|
Loading…
Reference in a new issue