pot value

Well, I tested the xbee's and such using different code. I sent the file to both arduinos to display an led on arduino2 that is controlled by a pot in arduino1 and it works. I tried outputting the values that arduino2 is receiving to control the led to the serial monitor but not getting anything with the usb from arduino2 to computer just like the code for the pot you've helped me on. Just was letting you know that the xbee's seem to be fine.

#define potPin 0
#define ledPin 11

int inByte = -1;
char inString[6];
int stringPos = 0;
int lastValue = 0;

void setup()  {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
} 

void loop() {
   inByte = Serial.read();

   //only send new value if it is different than last sent value.
   //Min value change of 5 neded. Just so we dont flood the network
   int potVal = analogRead(potPin);
   if( abs(potVal - lastValue) > 5){
     Serial.println(potVal);
     lastValue = potVal;
   }

  //if there is any numerical serial available, store that
  if((inByte >= '0') && (inByte <= '9')){
    inString[stringPos] = inByte;
    stringPos ++;
  }

  //if there is a line end character, this string is done, take value and write to LED pin
  //clear the string when done
  if(inByte == '\r'){
    int brightness = atoi(inString); //convert string to int
    Serial.print(brightness);
    //incoming will be a range of 0-1023, we need 0-255
    brightness = map(brightness, 0, 1023, 0, 255);
    analogWrite(ledPin, brightness);

    //clear the values from inString
    for (int c = 0; c < stringPos; c++){
      inString[c] = 0;
    }
    stringPos = 0;
  }

}