Ask for error codes

How can I ask for the error codes?

Thanks

Try the Code Reader sample application:
https://www.carloop.io/apps/app-code-reader/

Great thanks. Ill be trying after solving other issues.

I wasn’t able to test the app code reader until now. I cannot read error codes. The code reader always returns an error in this line:

if (reader.getError()) {
        Serial.println("Error while reading codes. Is Carloop connected to a car with the ignition on?");
        return;
   }

I can read other codes such as RPM’s, speed and so … Am I missing something ?

Thanks

What are you using to read codes from? A car or an emulator?

I’m using my car (Mazda 3 2015).

Is there any chance that your car doesn’t have any error code (DTC)? Not pending, current or cleared?

From my experience (with an emulator) I got that message when the board didn’t have any DTC.

That would mean that codes.getError() and codes.empty() would has “same” meaning ? if I got and error means that the car doesn’t have errors ?

As I see, the getError() method return true when there is some sort of “error” related with the communication with the car, but I can be wrong.

To be honest what I did was to get the core of that app. The CodeReader::transmitReadCodes() and CodeReader::receiveReadCodes() functions from “dtc.cpp”. Everything else was boilerplate code to me.
The results with my emulator are the same, it gets the codes of the different three states.

When tested in a car, I don’t get anything but I didn’t have, by the moment, any problems with my car (DTCs).

And with the message that you get, I think that it is a little bit deceptive because clearly you are getting that when the ignition is on, but also there is no way (with a function) to know if the ignition is on. What many people do is just send a message to the CAN and check for a response, if there isn’t a response, you assume that the engine is off.