Subtracting serial read parseInt from regular int

void setup() {
  
  Serial.begin(9600);
  
}
    int a = 30;  // KEY ~ 30 mm = 1.2" = 0.1'

  int len, m, measured, feet;    
  char testStr[] = "R0033\r";     // testing string
  len = strlen(testStr);
  //Serial.println(&testStr[len - 4]);
  
m = Serial.parseInt(testStr[len - 4]);     // This worked for just printing it. But it does not work when trying to do more.
// measured TTL serial output converted, only last three digits
  Serial.println(m);

  diffFromKey = abs(key - measured);

I am trying to take a measurement from a sensor and subtract it from what it's supposed to be reading. So in this case, it's supposed to read 30 mm, but "measures" 033 mm. (From there I want to do this:)

//    if(diffFromKey < 5)
//    lcd.print("Good: highly accurate reading near " + feet + "'");
//
//    if(diffFromKey <= 9 && diffFromKey >= 5)
//    lcd.print("Good: moderately close reading near " + feet + "'");   
//
//    if(diffFromKey > 9)
//    lcd.print("Bad: inaccurate reading of sensor.\nTry again or replace sensor.");

Please post your complete program.

I have no idea what you mean when you imply that an int produced by Serial.parseInt() is different from any other sort of int. They are all "regular" ints.

...R
Serial Input Basics - simple reliable ways to receive data.

m = Serial.parseInt(testStr[len - 4]);     // This worked for just printing it. But it does not work when trying to do more.

It doesn't work because that's not how it works. Read the documentation for parseInt
If you want an integer from that string try

m = atoi(&testStr[len - 4]);

Pete

el_supremo:

m = atoi(&testStr[len - 4]);

Thank you el_supremo!
Robin2, I can post the whole code later. It's just that almost everything else is unrelated.

adamaero:
It's just that almost everything else is unrelated.

Then you write a smaller code without all that irrelevant stuff. But it should still be complete and exhibit the problem. It's really hard to debug something from just one line of code.

When you know what the problem is THEN you can tell me what's relevant to finding it. But then you are wasting my time since you already know. If you don't know what the problem is then don't pretend that you know what is relevant to finding it.

Delta_G, the issue was solved. And yes, I did cut it out. I'm meaning to be completionist; I'll post the whole result of what I'm doing.