OBD shield: add voltage and version ELM calls to Github lib

I bought the CAN Bus shield https://www.sparkfun.com/products/13262, it works fine with the Github lib https://github.com/sparkfun/SparkFun_CA … no_Library for PID codes. But some bits of useful info (voltage, version) don’t use PID codes, they use ELM327 commands. In another Arduino OBD library, I found the relevant calls (below). Would it be possible to include them in your lib? I don’t think I can handle it myself.

float COBD::getVoltage()
{
    char buf[32];
	if (sendCommand("ATRV\r", buf, sizeof(buf)) > 0) {
		char* p = getResultValue(buf);
		if (p) return (float)atof(p);
    }
    return 0;
}

byte COBD::getVersion()
{
	byte version = 0;
	for (byte n = 0; n < 3; n++) {
		char buffer[32];
		if (sendCommand("ATI\r", buffer, sizeof(buffer), 200)) {
			char *p = strchr(buffer, ' ');
			if (p) {
				p += 2;
				version = (*p - '0') * 10 + (*(p + 2) - '0');
				break;
			}
		}
	}
	return version;
}

You can request a merge here https://github.com/sparkfun/SparkFun_CA … ary/issues and perhaps it’ll get added to the next update :wink:

OK, I’ll add it to that list. These are just examples I found somwehere, I don’t know if they can be merged in as-is. Someone at Sparkfun would need to vet / adapt them.