diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2015-11-04 19:56:15 +1100 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2015-11-04 19:56:15 +1100 |
commit | 79ace6117e7a7b4822ac08bb7f167d4a64667ece (patch) | |
tree | 89eeb2f2c16c8e698de9ac8a9aa7c30228447f4b /libraries/OBD/examples/obd_i2c_test | |
parent | 294a0db97a28926e45a86807a1af4f31138493fe (diff) | |
download | 2021-arduino-obd-79ace6117e7a7b4822ac08bb7f167d4a64667ece.tar.gz 2021-arduino-obd-79ace6117e7a7b4822ac08bb7f167d4a64667ece.tar.bz2 2021-arduino-obd-79ace6117e7a7b4822ac08bb7f167d4a64667ece.zip |
Update test sketch for OBD I2C Adapter
Diffstat (limited to 'libraries/OBD/examples/obd_i2c_test')
-rw-r--r-- | libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino | 18 |
1 files changed, 14 insertions, 4 deletions
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); } |