From 161d198c03e6ddae827de97049c63431335ea808 Mon Sep 17 00:00:00 2001 From: Stanley Huang Date: Sun, 29 Nov 2015 10:57:48 +1100 Subject: Update example sketch --- libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'libraries/OBD/examples/obd_i2c_test') 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 2a53a08..19db06f 100644 --- a/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino +++ b/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -18,14 +19,14 @@ MPU6050 accelgyro; void testOut() { static const char PROGMEM cmds[][6] = {"ATZ\r", "ATL1\r", "ATH0\r", "ATRV\r", "0100\r", "010C\r", "0902\r"}; - char buf[OBD_RECV_BUF_SIZE]; + char buf[128]; for (byte i = 0; i < sizeof(cmds) / sizeof(cmds[0]); i++) { char cmd[6]; memcpy_P(cmd, cmds[i], sizeof(cmd)); Serial.print("Sending "); Serial.println(cmd); - if (obd.sendCommand(cmd, buf)) { + if (obd.sendCommand(cmd, buf, sizeof(buf))) { char *p = strstr(buf, cmd); if (p) p += strlen(cmd); @@ -98,21 +99,23 @@ void setup() { accelgyro.initialize(); readMEMS(); - testOut(); + //testOut(); Serial.println("Init..."); - while (!obd.init()); + //while (!obd.init()); +/* char buf[OBD_RECV_BUF_SIZE]; if (obd.getVIN(buf)) { Serial.print("VIN:"); Serial.println(buf); } delay(1000); + */ } void loop() { - readPID(); + //readPID(); readMEMS(); delay(500); } -- cgit v1.2.3