TSOP1138 is not really designed for "beam breaking". Read page 5 of the datasheet and you'll see that it expects the IR signal to have 10 cycle pauses every 16-70 cycles. The preferred Vishay brand module would be TSOP4038 or TSOP58038 which is described as a "presence sensor" and has no cycle-pause requirement.

There's a lot of code and wiring that you aren't showing here. The code you've shown us is only designed to send IR signals and doesn't say anything about an IR receiver.

Seems that you've dropped carrier, but maybe you're still looking for a solution. "Chagrin" has touched on some good points.

Looking around, many have posed similar questions. I originally wrote this for someone in another forum.Have a look here, though:http://arduino.cc/forum/index.php/topic,70585.15.htmlhttp://arduino.cc/forum/index.php/topic,75566.0.html

It's not blazingly fast and it likely could stand some tweaking, but it may suffice for your needs.

"You gotta fight -- for your right -- to party!"Don't react - Read."Who is like unto the beast? who is able to make war with him?"Hey, it's "bipolar transistor" or "junction transistor" - "BJT" is just stupid.