I am making an RC car, and am worried that if my car turns around, the IR sensor will face away from my transmitter. the obvious solution is to attach another IR sensor facing the other direction, but I don't know how I would code that.
Currently the code I'm running looks a bit like this
Sorry, I cannot follow your code as it is currently formatted. Posting it properly would make it more readable.
As for your setup, you might consider placing the sensor in an acrylic cylinder to see if that helps. A few years ago, I used polysulfone for a similar application, but I no longer have access to it.
You may be able to mount a second IR receiver facing backwards and connect it's output to the same Arduino pin as the forward facing receiver. Sometimes the outputs of these receivers are "open collector" type. If so, 3 receivers at 120 degree angles could also be connected. No code changes would be required.
As suggested by @jim-p, a single upward-facing receiver could work. To make it more sensitive, it could be placed under an inverted dome or cone shaped reflector to concentrate the IR signal onto the receiver.
$7 cone reflector.
Normally used for making laser levels, but you can operate it in reverse to capture the light from all directions in a single plane.
I recently had a situation where two receivers didn't work. I added an IR extender to my cable TV box, but neglected to hide the box completely from the remote, so both the box and the extender were receiving IR. It kinda worked sometimes on the first button press, but then not after that for a while. Everything cleared up when I blocked IR from the box completely. On my scope, the extender looks like a regular 38KHz IR receiver. But clearly the receiver in the box and the extender were demodulating the IR signal differently enough that the timing was messed up. I don't know if the circuit inside the box is open collector, or an AND gate, or what. Anyway, there's no guarantee that two receivers will detect carrier aquisition, or loss thereof, with the same timing. If they don't, mixing their outputs may not work.
I wonder if you could point the receiver straight up, and put a clear plastic dome over it. IR would pass through the dome, then bounce off the inside surface of the dome on the opposite side, then down to the receiver.