summaryrefslogtreecommitdiff
path: root/libraries/OBD/examples/obd_i2c_test
diff options
context:
space:
mode:
authorStanley Huang <stanleyhuangyc@gmail.com>2015-11-29 10:57:48 +1100
committerStanley Huang <stanleyhuangyc@gmail.com>2015-11-29 10:57:48 +1100
commit161d198c03e6ddae827de97049c63431335ea808 (patch)
tree15772ba1f2f9462b3f4c7042e748fe38508ccf7c /libraries/OBD/examples/obd_i2c_test
parent6d3e3a5b5261360462d0e755c9e0967e2a0514bb (diff)
download2021-arduino-obd-161d198c03e6ddae827de97049c63431335ea808.tar.gz
2021-arduino-obd-161d198c03e6ddae827de97049c63431335ea808.tar.bz2
2021-arduino-obd-161d198c03e6ddae827de97049c63431335ea808.zip
Update example sketch
Diffstat (limited to 'libraries/OBD/examples/obd_i2c_test')
-rw-r--r--libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino13
1 files changed, 8 insertions, 5 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 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 <Arduino.h>
#include <Wire.h>
+#include <SPI.h>
#include <OBD.h>
#include <I2Cdev.h>
#include <MPU9150.h>
@@ -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);
}