From 79ace6117e7a7b4822ac08bb7f167d4a64667ece Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Wed, 4 Nov 2015 19:56:15 +1100 Subject: Update test sketch for OBD I2C Adapter --- libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'libraries/OBD/examples') diff --git a/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino b/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino index 82d5eb1..d73e207 100644 --- a/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino +++ b/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino @@ -71,7 +71,7 @@ void readMEMS() Serial.println(gz); } -void showECUCap() +void readPID() { static const byte PROGMEM pidlist[] = {PID_ENGINE_LOAD, PID_COOLANT_TEMP, PID_RPM, PID_SPEED, PID_TIMING_ADVANCE, PID_INTAKE_TEMP, PID_THROTTLE, PID_FUEL_LEVEL}; for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) { @@ -92,17 +92,27 @@ void showECUCap() } void setup() { - Serial.begin(115200); delay(500); + Serial.begin(115200); Wire.begin(); accelgyro.initialize(); - testOut(); readMEMS(); + + testOut(); + Serial.println("Init..."); while (!obd.init()); + + char buf[OBD_RECV_BUF_SIZE]; + if (obd.getVIN(buf)) { + Serial.print("VIN:"); + Serial.println(buf); + } + delay(1000); } void loop() { - showECUCap(); + readPID(); readMEMS(); + delay(500); } -- cgit v1.2.3