Water level monitoring system using Xbee

wvmarle:
That's plain ASCII.
10 = LF, 13 = CR
That sequence is a common line termination, in this case you're basically reading an empty line.
Numbers 48-57 are numerals 0-9.
The others (40-47, 48) are various signs. Don't know where that would come from.
Anyway you're getting your communication in ASCII, and that you have to wait for a LF/CR termination. And if it's really an ASCII character string, atoi() is back in the picture!

Ohh!! I am seeing some light here! Hahaha!

Why is that if is use the code

  if (XBee.available() > 0)
  { char message[5]; // holds the C-string
      for (int i=0; i<3; i++) 
      message[i] = XBee.read(); // read the characters from Serial
      message[3] = '\0'; // null termination
    int intValue = atoi(message); // convert to int
  }

I am still printing the ASCII. The serial monitor shows something similar to this:

10
10
13
48
56
53
52
52
10
13
13

something like that.

But now i somehow got an idea how this works. Thank you sir!