Do you want to turn left when one distance A is bigger than distance B and turn right when distance B is bigger than distance A?

If one device always measures more than the other by a constant amount then you should just correct that by subtracting that amount. Then the two values can be compared directly.

What @Awol referred to is the abs() function which returns the absolute value of a number by ignoring the negative sign. But if the first paragraph, above, is correct then I think you need the sign to tell you which way to turn.

If you do need to test for a difference greater than 5 you could do

`if (cmA - cmB >= 5) {`

// turn one way

}

if (cmB - cmA >= 5) {

// turn the other way

}

...R