Read Rpm with ELM 327

Hi guys.

So it's a little complicated but I try to explain....

Do you see my code? like many others on same topic... It works but it is actually ain't right..

The big mistake is that, that the ELM 327. needed to get the command only once for certain PID's. to send to the car..

In my code I sending the PID (010C) every time the loop runs but actually I only need send the command only once then I need just read "Str" every time cause ELM just once get the command and start run its loop on it... start sending it and reviving the answer from the car constantly until it's power on or you change the PID. once again in my code: I need send PID (010C) to ELM 327 only once then read Str every 0.5 second. Str got new info every 0.5 sec... So how to go around this????

I could do it from void setup but the code will be only for RPM then when I need to have for many things..

Thanks for any help..

String Str;

void setup()
{
  Serial.begin(9600);                         //This serial see what's up happaning
  Serial.println("Start");
  
  Serial1.begin(9600);
  Serial1.println("ATZ/r");
  delay(1000);                               // On this one ELM 327 Sitting
  
  Serial3.begin(115200);
 // Serial3.write(0x81);
//  Serial3.write(10);                         // This is LCD printing the result

void loop()
{
  Serial1.flush();                             
  Serial1.print("010C\r");                    // that's exactly I only need send once and it has to be in the loop... As soo is I send it Str will be stuffing with ELM answer every half a sec
  
  
  Str = Serial1.readString();
  Serial.println(Str);                     // That's exactly I need to read every time... And better if info changes then do the rest code
  
  String A = Str.substring(11,13);
   String B = Str.substring(14,16);           
  Serial.println(A);
  Serial.println(B);

 //((A*256)+B)/4
  
int long Ch = ((strtol(&A[0], 0, 16) * 256) + strtol(&B[0], 0, 16)) / 4;

Serial3.write(0xFE);
Serial3.write(0x01);

if (Ch == 640){ Ch = 1;}

Serial3.write(0xFE);
Serial3.write(0x01);

Serial3.print(Ch);
Serial3.print(" Rpm");




}