How can I be engaging the arduino mega with OBD-II UART card?

Currently I have begun working with the OBDII UART card connected to the Arduino board, I followed the example is the page of the card OBD II UART Hookup Guide - SparkFun Learn, but when I set the protocol sends me Ok, but when I ask for the speed I send a message from Seeking I do not understand ... that's what happens

Currently I have been doing a project where I need to know the speed of the vehicle, I have implemented the following code but the results have not been good because when the vehicle is in motion always prints STOPPED
I connected the OBDII-UART card with Sparkfun Arduino MEGA.
I really need help :cold_sweat:

  1. char rxData[20];
  2. char rxIndex = 0;
  3. String inputString = "";
  4. boolean stringComplete = false;
  5. void setup(){
  6. Serial.begin(9600);
  7. Serial1.begin(9600);
  8. Serial.flush();
  9. Serial1.flush();
  10. //Reset IC
  11. Serial1.println("ATZ");
  12. delay(1500);
  13. getOBDResponse();
  14. Serial.println(rxData);
  15. clearBuffer();
  16. getOBDResponse();
  17. Serial.println(rxData);
  18. clearBuffer();
  19. //Sets IC to defults
  20. Serial1.println("ATD");
  21. delay(1000);
  22. getOBDResponse();
  23. Serial.println(rxData);
  24. clearBuffer();
  25. getOBDResponse();
  26. Serial.println(rxData);
  27. clearBuffer();
  28. Serial1.println("ATSP0");
  29. delay(1000);
  30. getOBDResponse();
  31. Serial.println(rxData);
  32. clearBuffer();
  33. getOBDResponse();
  34. Serial.println(rxData);
  35. clearBuffer();
  36. Serial1.println("010D");
  37. delay(1000);
  38. getOBDResponse();
  39. Serial.println(rxData);
  40. clearBuffer();
  41. getOBDResponse();
  42. Serial.println(rxData);
  43. clearBuffer();
  44. Serial1.println("ATDP");
  45. delay(1000);
  46. getOBDResponse();
  47. Serial.println(rxData);
  48. clearBuffer();
  49. getOBDResponse();
  50. Serial.println(rxData);
  51. clearBuffer();
  52. //Bus initiation
  53. Serial1.println("ATSI");
  54. delay(3000);
  55. getOBDResponse();
  56. Serial.println(rxData);
  57. clearBuffer();
  58. getOBDResponse();
  59. Serial.println(rxData);
  60. clearBuffer();
  61. Serial.flush();
  62. Serial1.flush();
  63. }
  64. void loop(){
  65. /*
  66. if(stringComplete){
  67. Serial.println(inputString);
  68. inputString = "";
  69. stringComplete = false;
  70. }
  71. */
  72. Serial1.flush();
  73. Serial1.println("010D");
  74. getOBDResponse();
  75. Serial.println(rxData);
  76. clearBuffer();
  77. getOBDResponse();
  78. Serial.println(rxData);
  79. clearBuffer();
  80. }
  81. void getOBDResponse(){
  82. char inChar = 0;
  83. while(inChar != '\r'){
  84. if(Serial1.available() > 0){
  85. if(Serial1.peek() == '\r'){
  86. inChar = Serial1.read();
  87. rxData[rxIndex] = '\0';
  88. rxIndex = 0;
  89. }else{
  90. inChar = Serial1.read();
  91. rxData[rxIndex++] = inChar;
  92. }
  93. }
  94. }
  95. }
  96. void clearBuffer(){
  97. int i;
  98. for(i = 0; i < 20; i++){
  99. rxData = '';
    100. }
    101. }
    102. void serialEvent1(){
    103. while(Serial1.available()){
    104. char input = (char)Serial1.read();
    105. inputString += input;
    106. if(input == '\r'){
    107. stringComplete = true;
    108. }
    109. }