About setting up communication between XBee Pro

Now the sensor can send data through USB cable to my PC.
But how can i change my code to send the data through my pair of transceivers???

No changes to the code are required.

The switch on the shield needs to be in the correct position. It needs to be in one position for the PC to talk to the Arduino, and in the other position for the Arduino to talk to the XBee.