Arduino Leonardo and Xbee series 1 wireless communication


Could someone tell me how to receive data from XBee series 1 on Arduino Leonardo ? I can receive any data from my xbee transmitter which is connected with a potentiometer, and totally get lost... Any correction on my code would be sincerely appreciated.

My enviroments. - Arduino Leonardo - two XBee (Series 1) - XBee shield from - XBee Explorer Regulated - a potentiometer

two Xbees are well configured using X-CTU software (from digiKey) and has been tested without using leonardo. Right now I have my xbee receiver connected to leonardo through xbee shield. I would like to use a code to achieve voltage readout from my potentiometer which is connected with my xbee transimtter. Potentiometer voltage signal sends to DIO pin in xbee transmitter. 3.3V DC power is supplied to both Xbee trasmitter and potentiomter. And 3.3V pin and RES on my xbee transmitter has been wired together.

I followed the advice from this thread (,114936.0.html). physically connect a 100uF capacitor (monolithic type, no polarity issue involved) the 3.3v pin and RES on my xbee receiver (which is what they call the shield's xbee) and run a IDE code looking like below:

void setup() {
  while(!Serial){}; //required for the Leonardo

void loop() {
    Serial1.write(;// input from Serial to Serial1
    Serial.write(; //input from Serial1 to Serial

  // read the input pin:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (3.3 / 1023.0);
  // print out the value you read:

Let me know what I should do next. Thanks a lot.

Any suggestions on code or arrangement? Thanks.