can someone explain me how to write code to read Diagnostic Trouble Codes from car using obd2 usb interface?
for example in python using PID commands for OBDII and maybe using older standard.
Because I want to know and compare both codes. I wounder how to communicate with older cars like bmw e38 728i where is ISO9141-2 but there is no obd2 interface i have to use adapter, the same for honda CR-V rd1 where is 3 pin adapter.
Can u write me an example of code?
I used pySerial to write simple code:
import serial
import time
ser = serial.Serial(port="COM5", baudrate=921600, bytesize=8, timeout=1)
ser.write(b"0100rn")
time.sleep(3)
res = ser.read(ser.in_waiting)
print(res)
time.sleep(3)
ser.close()