sandeepmistry / arduino-OBD2

An Arduino library for reading OBD-II data from your car over CAN bus
MIT License
462 stars 104 forks source link

Read stored DTC and clear MIL #5

Open pniewiadowski opened 4 years ago

pniewiadowski commented 4 years ago

Hi,

first of all thank you for this library!

Don't know if creating an issue is the right way, but I wasn't able to figure out how to use the OBD2 library to read all the stored DTC codes and then try to clear them which result turning off the MIL light

Are you able to help?

dsbilling commented 3 years ago

Thats really dependant on the make and model of the car.

JasonJoyner01 commented 3 years ago

Thats really dependant on the make and model of the car.

You should be able to receive the DTC codes according to the OBDII standard if you send a message using mode 3, without a PID included. Clearing the DTCs is done the same way, except by sending a message with mode 4.

https://en.wikipedia.org/wiki/OBD-II_PIDs#Service_03

https://en.wikipedia.org/wiki/OBD-II_PIDs#Service_04

However, you cannot do this with the arduino-OBD2 library as written. You'd need to reimplement the pidRead private function in your code using the underlying arduino-CAN library.

Something like: pidRead(0x03, pid not needed, data, sizeof(data))

s89281b commented 3 years ago

Thank you for this library. It has been a great help to me in my trying to learn how to use arduino in my car. I see that clear dtc function has been added to the library but It is not called out in any of the examples. Can you point me in the right direction as to where I need to insert in example.