ELMduino icon indicating copy to clipboard operation
ELMduino copied to clipboard

How to read data if I know TXD RXF RXD and MTH

Open BCProgrammingTH opened this issue 1 year ago • 1 comments
trafficstars

I want to read the transmission fluid temperature in my Subaru XV, but I don't know how to take the values. How to put it in the reading process to be complete?

Hardware

  • ESP32
  • ELM327

chrome_xFiaWVXOXn

BCProgrammingTH avatar May 25 '24 13:05 BCProgrammingTH

Here are a few links that might help:

PowerBroker2 avatar May 25 '24 16:05 PowerBroker2

I am a beginner I'm not sure if my use of processPID is correct. I don't quite understand the RXD part of how to use it with processPID.

RXD: 3008

#include "ELMduino.h"
#define DEBUG_PORT Serial
ELM327 myELM327;
int nb_query_state = SEND_COMMAND; // Set the inital query state ready to send a command

void setup()
{
  DEBUG_PORT.begin(115200);
  Serial2.begin(115200, SERIAL_8N1, 16, 17);

  if (!myELM327.begin(Serial2, true, 3000))
  {
    Serial.println("ELM327 device couldn't connect to ECU.");
    while (1);
  }

  Serial.println("Connected to ELM327");
  // Set a custom header using ATSH command.
  myELM327.sendCommand_Blocking("AT SH 7E1");
}
void loop()
{
  float temp = myELM327.processPID(34, 4119, 1, 1, 9 / 5, -58);
  if (myELM327.nb_rx_state == ELM_SUCCESS)
  {
    Serial.print("Temp: "); Serial.println(temp);
  }
  else if (myELM327.nb_rx_state != ELM_GETTING_MSG)
    myELM327.printError();
}

javaw_kYk8sgAMOl

BCProgrammingTH avatar May 26 '24 14:05 BCProgrammingTH