Arduino xbee???

I have an arduino with xbee shield and xbee(1) radio in my room(A). I put a xbee(2) radio in room(B) to read the state of a switch on xbee(2) radio pin AD0/DIO0. While monitoring xbee(2) from my arduino in room(A), if AD0/DIO0 goes low on xbee(2) I want my arduino to receive this data and send a command out to drive AD1/DIO1 high on xbee(2) to turn on a transistor. But I am not sure how to do this? Please help. I think I have to send the AT commands out in their hex form, is this correct and I am not sure how or what the commands are. Looking for help with arduino code??
Thanks
RB

Have you seen:

http://rapplogic.blogspot.com/2009/05/arduino-xbee-portal.html

It may answer your questions.