XBee data with random -38 and -35 values

Those -35 and -38 are when it is not getting any data.

The calculation char-'0' will calculate an integer equal to the number of spots in the ascii table between the character you got, and the character '0'. This is only a meaningful calculation if the character you got is actually in the range '0' to '9'.

An ascii '0' is 48 decimal, so if you calculation gives you -35 or -38, you actually got a character with the numerical value of 13 or 10 decimal, which a quick look at the ascii chart, are "carriage return" and "line feed".

You probably want to change your logic to ignore those, or only to process you input if it is actually a character '0' to '9'