I have been looking into duplicating a laser tag protocol on the Arduino. One thing I am having trouble with is the duplex nature of needing to emit over IR while sensing and reading incoming IR. Is this a possibility with the Arduino? The IR data is based on pulse codes and I have read about delay and how it is better to use millis for timing delays. However the pulses are on the order of 600 microseconds. I have thought through how to emit IR and how to read IR but not exactly how to do both simultaneously.
Looking for any ideas or examples for this type of thing. Can serial communications drive 0 to 5 volts on a pin while reading at the same time?
I do not know what you are trying to do but if you need to log and recunstruct something with a period 600us, you'll need to sample at a higher rate than 3332 Hz which is easily done with arduino.
I have seen examples to read IR that use pulseIn(). It seems an easy way to read IR in, but the examples all seem to wait for IR to come in and then process it. While in my application I want to be able to have the user shoot the laser gun, thus sending out an encoded IR signal while also being able to read an incoming IR signal as well, without missing it and being able to process both. Hopefully that helps explain this some.
One worry I have is that if someone is continuously shooting, the arduino will never have a rest to read incoming IR to see if anyone has shot them. And if I did stop to read incoming IR it seems that I would then have messed up my timing of an outgoing signal. Seems to me if I detect an incoming IR signal I would have to stop everything else and wait for the complete signal to come in before continuing.
Also in regards to examples I have seen to emit an IR signal, the ones I have seen do not consider the possibility of receiving an IR signal in the middle of transmitting one out. So I am wondering about how to handle these situations without losing any data in or out.