wirelessly turning on and off another arduino

hey guys, i recently started working with arduino and xbees, I am trying to make my xbee pro s2 on a shield turn another xbee pro s2 on another shield on and off. Both xbees are on separate arduino board. here is the code i have written so far but it doesn't do anything.

thanks for the help in advance

Here is my current code for the sender arduino.

const int buttonPin = 2;
void setup()
{
   Serial.begin(9600); 
   pinMode(buttonPin, INPUT);
}
void loop()
{
  digitalRead(buttonPin == 'H') ;
  delay(100);
  digitalRead(buttonPin == 'L');
  delay(100);
  }

here is my code for the receiving arduino:

const int ledPin = 13;
int incoming;
void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  Serial.print("start on S");
}
void loop()
{
  if(Serial.available() > 0);
  {
    incoming = Serial.read();
    if(incoming == 'H') {
    digitalWrite(ledPin, HIGH);
  }
  if( incoming == 'L') {
    digitalWrite(ledPin, LOW);
  }
}
}
  digitalRead(buttonPin == 'H') ;

Which pin are you reading from? Since 2 is not equal to 'H", you are reading a value from the false pin, and discarding that value. Why bother?

Your "sender" code is not sending anything.

Therefore, there is nothing for your receiver to receive.

Before you start with wireless, you should make sure that you know what you are doing, wired. Perhaps you need another Jolt cola or two.

I am trying to make my xbee pro s2 on a shield turn another xbee pro s2 on another shield on and off.

Once you turn the remote xbee off, how will you ever be able to communicate with it to tell it to turn back on?

Once you turn the remote xbee off, how will you ever be able to communicate with it to tell it to turn back on?

.

zoomkat, my bad for the misinterpretation.. i mean turning on and off the led on pin 13.