You are probably better off using some kind of 555 timer connected to the IR LED circuit to create the 38kHz carrier frequency than trying to generate it with PWM [analogWrite() command]. Connect that timer to a digital pin. When you set the pin high, it will automatically oscillate at the correct frequency. It is a lot more accurate and the Arduino is freed up inside the pulses to do other work. Here is a page on 555 http://www.uoguelph.ca/~antoon/gadgets/555/555.html
oscillators. You need to get the right resistor-capacitor combo to achieve 38kHz. This site provides a simple formula. Also, if there is going to be no actual data communication (other than a 'switch') b/w these 2 modules, there are probably easier ways to do what I think you are talking about using just 2 IR LEDS.