I built a laser tag gun using an Arduino,but there is a problem. When I use it indoors with lens or without I have beam reflections. If I shoot on the wall the receiver also claims a "hit." Is there a method to prevent the beam reflection?
I'm using IRremote.h library. For receiving the message I use a TSOP32236 receiver and I use 8 degree angle IR LED.
#include <IRremote.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int led = 10;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
irrecv.blink13(true);
pinMode(led, OUTPUT);
}
void loop(){
if (irrecv.decode(&results)){
Serial.println(results.value);
if(results.value == 2704){
digitalWrite(led, HIGH);
delay(100);
digitalWrite(led, LOW);
}
else {
digitalWrite(led, LOW);
}
irrecv.resume();
}
}