Freematics OBD-II UART version problems

Hello,

I have this code to run on Arduino Uno and print some engine data unfortunately only read the fist value (RPMs) and the other return 0 always, also the next time that the loop() is executed does not refresh the paremeters,can somebody help me?

#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>
#include <OBD.h>

SoftwareSerial mySerial(2, 3); // RX, TX

#define PID_ENGINE_FUEL_RATE 0x5E

//Global objets and variables
COBD obd;

int value0;
int value1;
int value2;
int value3;
int value4;
int value5;
int value6;
bool err;

void setup()
{
  //Wait 10 seconds for connect debug device
  delay(1000*10);
  mySerial.begin(9600);
  mySerial.println(F("OBD-II test"));
  mySerial.println(F("Copyright (C) 2015 Custodium soluciones y sistemas SL"));
  mySerial.println();
  
  // start communication with OBD-II UART adapter
  mySerial.println(F("obd.begin()"));
  obd.begin();
  // initiate OBD-II connection until success
  mySerial.println(F("Waiting while !obd.init()"));
  while (!obd.init());  
}

void loop()
{
  mySerial.println(F("Entering loop"));
  err=obd.read(PID_RPM, value0);
  /*
  if(!err) {
    mySerial.println(F("Error reading"));
  }
  */
  mySerial.print(F("RPM: "));
  mySerial.println(value0);
  delay(100);
  
  err=obd.read(PID_ENGINE_TORQUE_PERCENTAGE, value1);
  mySerial.print(F("ENGINE_TORQUE_PERCENTAGE: "));
  mySerial.println(value1);
  delay(100);
  
  err=obd.read(PID_ENGINE_REF_TORQUE, value2);
  mySerial.print(F("ENGINE_REF_TORQUE: "));
  mySerial.println(value2);
  delay(100);
  
  err=obd.read(PID_ENGINE_REF_TORQUE, value3);
  mySerial.print(F("ENGINE_REF_TORQUE: "));
  mySerial.println(value3);
  delay(100);
  
  err=obd.read(PID_MAF_FLOW, value4);
  mySerial.print(F("MAF_FLOW: "));
  mySerial.println(value4);
  delay(100);
  
  err=obd.read(PID_SPEED, value5);
  mySerial.print(F("SPEED: "));
  mySerial.println(value5);
  delay(100);
  
  err=obd.read(PID_ENGINE_FUEL_RATE, value6);
  mySerial.print(F("FUEL_RATE: "));
  mySerial.println(value6);
  delay(100);
  
  delay(1000*10);
  mySerial.println("Exiting loop");

}

Best regards and thanks in advance

Your code looks correct, so far, assuming that you use the constants correctly in obd.read().

I'd check err after every call.

My most prominent trouble candidate is SoftwareSerial, which may interfere with the OBD library.