Getting RSSI Value From XBee

Thank you to anyone reading this, and even more so if you have any help for me. My project for college is to have my robot drive towards wifi hotspots using the RSSI value gained from an XBee. The problem I have is, I dont know enough about arduino language to be able to get the RSSI value from the chip. Any help that can be given to me would be awesome, This is what I have so far:

void initXbee(){
  // clear the serial port so no buggy data will be there
  Serial.flush();
  // delay needed for.. I dont have a f*ckin clue..
  delay(1200);
  // put xbee in command mode
  Serial.print("+++");

  // a check could be build in:
/*
  char thisByte = 0;
  while (thisByte != '\r'){ // wait for the xbee to respond, being in command mode
    if (Serial.available() > 0){
      thisByte = Serial.read();
    }
  }
*/
  // but that is not really needed in my opinion
  // and I just use a delay
  delay(500);
  // set the low part of the address to 0 and the high part to FFFF => broadcast mode
  Serial.print("ATDH0,DLFFFF,");
  delay(10);
  // set the xbee's own address
  Serial.print("MY1,"); // of 4
  delay(10);
 /* // set the network id, choose a strange key
  // in this case 8 = lucky number in china
  Serial.print("ID8888,");
  delay(10);*/
  // set the api mode to 1
  // 0 = no rssi
  // 1 = rssi
  // 2 = rssi with escaping
  Serial.print("AP1,");
  delay(10);
  // set the rssi value
  // I think this is only usefull if you use the analog pin on the xbee itself to read the rssi ** after finishing this project i read something different about this, cant remember where **
  // see the xbee manual for more details
  Serial.print("RP40,");
  delay(10);
  // set the boudrate to 9600
  // this will give the highest speed with no data buffering on the xbee
  // see the xbee manual for more details
  Serial.print("BD3,");
  delay(10);
  // exit command mode
  Serial.print("CN");
  // wait for a while
//  delay(1200);
}

Any help would be wonderful. Thanks again for your time.

"How to Win Friends and Influence People" does not have a chapter on cross-posting. There is a reason for that.

// delay needed for.. I dont have a f*ckin clue..
delay(1200);
// put xbee in command mode
Serial.print("+++");

Such a delay might be part of the protocol to set the commandmode. Have a lookup in the datasheet of the XBee. second this type of comment doesn't help either:)
Try the word TODO as comment, it helps you to find all the points to fix - some compiler environment even highlight TODO!
e.g.
// delay needed for .. TODO cannot be removed, find out why


// a check could be build in:
...
// but that is not really needed in my opinion

The check is far more robust that the delay (fact), suppose it only needs 10 millis to respond, now you wait 500! and you don't know if the response came.
More importantly your code probably follows the protocol better with a test


// set the low part of the address to 0 and the high part to FFFF => broadcast mode
Serial.print("ATDH0,DLFFFF,");

The code and comment seem to be in conflict ==> code allways wins :wink:

sofar my 2 cents,
Rob

XBee isn't wifi so that idea is flawed.

It could travel towards other XBee modules (possibly)