How to use the No-Blocking function for standard PID (such as OBD standard)?
wcjxixi opened this issue · 0 comments
wcjxixi commented
I want to get the OBD standard of the vehicle, but I want to use the No-Blocking function.
My code:
void getOBDStandard() {
char OBDStandard[20];
myELM327.sendCommand_Blocking("0128"); // Service 01 / PID 28
if (myELM327.nb_rx_state == ELM_SUCCESS) {
myELM327.get_response();
for (byte i = 0; i < myELM327.PAYLOAD_LEN; i++) {
OBDStandard[i] = myELM327.payload[i];
}
Serial.println("OBD Standard is: " + String(OBDStandard));
} else if (myELM327.nb_rx_state != ELM_GETTING_MSG) {
Serial.println("OBD Standard is: " + "Unavailable");
}
}
The code above gives me the original response packet.
Which function in the ELMduino library should I use to parse the response packet? In this way, I can get the values representing the OBD standard (such as 1, 2...etc.).
I am a newbie. Please give me some tips, or better yet, add and modify the corresponding code in my code, thank you very much!