The Theory
The core infrared theory for getting this tutorial working was already described in the Infrared Receiver tutorial, so I'll run through an abridged version here. First I'll describe as an overview what infrared is and how it relates to our lives, then I'll go further to how we can transmit digital data over this wireless link.
The way that the infrared transmitter and receiver pair works is similar to the way that our eyes work. We can see many different colors and depending on what we see, we act. The phototransistor functions in a similar way, it reacts depending upon the intensity of infrared light being shined at it.

The real difference between the two similar cases above is that our brains already have a way to interpret the different wave lengths of color, where the infrared LED and phototransistor need some intelligent electronics in order to know what to do when certain data is transmitted.

Sending Data Over IR

If you're still scratching your head in confusion as to how 0's and 1's can be transmitted using the IR emitter and phototransistor, then build the circuit seen below and it should help make things more clear:

Here's how the circuit above works: The 9v battery is hooked up to both the IR Emitter and Phototransistor. The IR Emitter, however, is never turned on unless you press the push button. Since the emitter is not powered on, the phototransistor won't allow current to flow through it, so current will instead flow through the red LED. This means until you press the push button, the red LED remains on. After you press the push button, the emitter shines brightly at the phototransistor and the red LED turns off. Here's a video of this circuit in action:

This should give you a much better visual of how digital 0's and 1's can be transmitted wirelessly using these two infrared components. When the red LED shines, you can see a digital 1. When we press the push button and the red LED turns off, that would be a 0.
Now if we replace a steady stream of digital 1's and 0's where the push button is the receiving phototransistor will see the same stream of digital 0's and 1's. Bingo! Wireless transmission. Feed the received stream of digital data into the receiving 18F452 microcontroller and the system is complete.

;