Guck dir das mal an: https://learn.sparkfun.com/tutorials/ir-communication .
Ziemlich gut erklärt.