diff options
author | Stanley Huang <stanleyhuangyc@gmail.com> | 2015-12-05 15:49:28 +1100 |
---|---|---|
committer | Stanley Huang <stanleyhuangyc@gmail.com> | 2015-12-05 15:49:28 +1100 |
commit | 7aff146ad7b3bdd70901f77b0aadfc32dbdd56f5 (patch) | |
tree | 37081c92317b576744dc186d6f9cf788c879d8c1 /libraries/OBD/examples | |
parent | c25dc8142813ad90438a42f1c5e5dd8d538ff428 (diff) | |
download | 2021-arduino-obd-7aff146ad7b3bdd70901f77b0aadfc32dbdd56f5.tar.gz 2021-arduino-obd-7aff146ad7b3bdd70901f77b0aadfc32dbdd56f5.tar.bz2 2021-arduino-obd-7aff146ad7b3bdd70901f77b0aadfc32dbdd56f5.zip |
Update example sketches for OBD library
Diffstat (limited to 'libraries/OBD/examples')
-rw-r--r-- | libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino | 20 | ||||
-rw-r--r-- | libraries/OBD/examples/obd_uart_test/obd_uart_test.ino | 7 |
2 files changed, 18 insertions, 9 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 9911897..fe9141a 100644 --- a/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino +++ b/libraries/OBD/examples/obd_i2c_test/obd_i2c_test.ino @@ -55,25 +55,31 @@ void readMEMS() accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); temp = accelgyro.getTemperature(); - // display MEMS data + Serial.print('['); + Serial.print(millis()); + Serial.print(']'); + Serial.print("ACC="); Serial.print(ax); - Serial.write('/'); + Serial.print('/'); Serial.print(ay); - Serial.write('/'); - Serial.println(az); + Serial.print('/'); + Serial.print(az); - Serial.print("GYRO="); + Serial.print(" GYRO="); Serial.print(gx); - Serial.write('/'); + Serial.print('/'); Serial.print(gy); - Serial.write('/'); + Serial.print('/'); Serial.println(gz); } void readPID() { static const byte pidlist[] = {PID_ENGINE_LOAD, PID_COOLANT_TEMP, PID_RPM, PID_SPEED, PID_TIMING_ADVANCE, PID_INTAKE_TEMP, PID_THROTTLE, PID_FUEL_LEVEL}; + Serial.print('['); + Serial.print(millis()); + Serial.print(']'); for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) { byte pid = pidlist[i]; bool valid = obd.isValidPID(pid); diff --git a/libraries/OBD/examples/obd_uart_test/obd_uart_test.ino b/libraries/OBD/examples/obd_uart_test/obd_uart_test.ino index 944d6f2..adb68b0 100644 --- a/libraries/OBD/examples/obd_uart_test/obd_uart_test.ino +++ b/libraries/OBD/examples/obd_uart_test/obd_uart_test.ino @@ -13,8 +13,8 @@ // On Arduino Leonardo, Micro, MEGA or DUE, hardware serial can be used for output // as OBD-II adapter should connect to Serial1, otherwise we use software serial -SoftwareSerial mySerial(A2, A3); -//#define mySerial Serial +//SoftwareSerial mySerial(A2, A3); +#define mySerial Serial COBD obd; @@ -51,6 +51,9 @@ void testOut() void readPID() { static const byte pidlist[] = {PID_ENGINE_LOAD, PID_COOLANT_TEMP, PID_RPM, PID_SPEED, PID_TIMING_ADVANCE, PID_INTAKE_TEMP, PID_THROTTLE, PID_FUEL_LEVEL}; + mySerial.print('['); + mySerial.print(millis()); + mySerial.print(']'); for (byte i = 0; i < sizeof(pidlist) / sizeof(pidlist[0]); i++) { byte pid = pidlist[i]; bool valid = obd.isValidPID(pid); |