Forum >Replies by mykoch
userhead mykoch
Replies (4)
  • You Reply: Dear Stanley,

    Could you please give us a very simple scetch including library file just to read RPM, because below code giving a lot of error.

    Mykoch



    [quote="stanleyhuang"]
    Here is a simplest sketch:
    [code]#include <OBD.h>

    COBD obd; /* for UART version */
    //COBDI2C obd; /* for I2C version */

    void setup()
    {
      // we'll use the debug LED as output
      pinMode(13, OUTPUT);
      // start communication with OBD-II adapter
      obd.begin();
      // initiate OBD-II connection until success
      while (!obd.init());
    }

    void loop()
    {
      int value;
      // save engine RPM in variable 'value', return true on success
      if (obd.ReadSensor(PID_RPM, value)) {
        // light on LED on Arduino board when the RPM exceeds 5000
        digitalWrite(13, value > 5000 ? HIGH : LOW);
      }
    }[/code]
    [/quote]
  • You Reply: Dear Stanley,

    Could you please give us a very simple scetch including library file just to read RPM, because below code giving a lot of error.

    Mykoch



    [quote="stanleyhuang"]
    Here is a simplest sketch:
    [code]#include <OBD.h>

    COBD obd; /* for UART version */
    //COBDI2C obd; /* for I2C version */

    void setup()
    {
      // we'll use the debug LED as output
      pinMode(13, OUTPUT);
      // start communication with OBD-II adapter
      obd.begin();
      // initiate OBD-II connection until success
      while (!obd.init());
    }

    void loop()
    {
      int value;
      // save engine RPM in variable 'value', return true on success
      if (obd.ReadSensor(PID_RPM, value)) {
        // light on LED on Arduino board when the RPM exceeds 5000
        digitalWrite(13, value > 5000 ? HIGH : LOW);
      }
    }[/code]
    [/quote]
  • You Reply: When we run this code it give below errors;

    In file included from sketch_apr24a.ino:1:
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:61: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:64: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:65: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:66: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:67: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:68: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:69: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:70: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:72: error: 'getResponse' declared as a 'virtual' field
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:72: error: expected ';' before '(' token
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:73: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:74: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:81: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:82: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:84: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:88: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:92: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:96: error: 'int16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h: In constructor 'COBD::COBD()':
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'dataMode'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'errors'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'm_state'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h: At global scope:
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:117: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:118: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:123: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:124: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:125: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:129: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:130: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:135: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:136: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:137: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:138: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:143: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:145: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:148: error: 'uint16_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:149: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:149: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:150: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:150: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:153: error: 'uint32_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'uint8_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:157: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:158: error: 'byte' does not name a type
    sketch_apr24a.ino: In function 'void loop()':
    sketch_apr24a:20: error: 'class COBD' has no member named 'ReadSensor'






    [quote="stanleyhuang"]
    Here is a simplest sketch:
    [code]#include <OBD.h>

    COBD obd; /* for UART version */
    //COBDI2C obd; /* for I2C version */

    void setup()
    {
      // we'll use the debug LED as output
      pinMode(13, OUTPUT);
      // start communication with OBD-II adapter
      obd.begin();
      // initiate OBD-II connection until success
      while (!obd.init());
    }

    void loop()
    {
      int value;
      // save engine RPM in variable 'value', return true on success
      if (obd.ReadSensor(PID_RPM, value)) {
        // light on LED on Arduino board when the RPM exceeds 5000
        digitalWrite(13, value > 5000 ? HIGH : LOW);
      }
    }[/code]
    [/quote]
  • You Reply: When we run this code it give below errors;

    In file included from sketch_apr24a.ino:1:
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:61: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:64: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:65: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:66: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:67: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:68: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:69: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:70: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:72: error: 'getResponse' declared as a 'virtual' field
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:72: error: expected ';' before '(' token
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:73: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:74: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:81: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:82: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:84: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:88: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:92: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:96: error: 'int16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h: In constructor 'COBD::COBD()':
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'dataMode'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'errors'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:58: error: class 'COBD' does not have any field named 'm_state'
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h: At global scope:
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:117: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:118: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:123: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:124: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:125: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:129: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:130: error: 'uint32_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:135: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:136: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:137: error: 'uint16_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:138: error: 'uint8_t' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:143: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:145: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:148: error: 'uint16_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:149: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:149: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:150: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:150: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:153: error: 'uint32_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'uint8_t' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:156: error: 'byte' has not been declared
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:157: error: 'byte' does not name a type
    C:\Arduino\arduino-1.5.4\libraries\OBD/OBD.h:158: error: 'byte' does not name a type
    sketch_apr24a.ino: In function 'void loop()':
    sketch_apr24a:20: error: 'class COBD' has no member named 'ReadSensor'






    [quote="stanleyhuang"]
    Here is a simplest sketch:
    [code]#include <OBD.h>

    COBD obd; /* for UART version */
    //COBDI2C obd; /* for I2C version */

    void setup()
    {
      // we'll use the debug LED as output
      pinMode(13, OUTPUT);
      // start communication with OBD-II adapter
      obd.begin();
      // initiate OBD-II connection until success
      while (!obd.init());
    }

    void loop()
    {
      int value;
      // save engine RPM in variable 'value', return true on success
      if (obd.ReadSensor(PID_RPM, value)) {
        // light on LED on Arduino board when the RPM exceeds 5000
        digitalWrite(13, value > 5000 ? HIGH : LOW);
      }
    }[/code]
    [/quote]