This project is inspired by the game commonly known as Laser Tag, which consists of shooting targets or people with laser guns. In this interpretation of the game, targets will be implemented in a display which the player will have to shoot down with a laser gun. Once the target is hit, it will go down and the score will increase. The player will be attempting to increase the score every time they play. In the diagram below, the basic design of the game is portrayed, where three targets are available for the player to hit and the scoreboard shows when they scored.
In order to make the idea a reality, we would use a photoresistor (LDR) and a micro servo motor on each of the targets. In the beginning a randomly chosen target goes up to 90º. At that point the microcontroller (Arduino) is controlling the position of that specific servo motor and is simultaneously checking the value from the corresponding photoresistor. When the LDR detects the laser light (above threshold value), the Servo Motor from the target will shift from 90º to 0º and make the target go down, to simulate that it has been hit. At the same time, the green LED will blink, confirming impact. Next the process continues and again one of the targets randomly goes up. Every time a target gets hit, the score increases on the Serial Monitor of the computer; however, this is not visible for the user in the physical model unless they look at the computer.
Specifying the Functionality of the Circuit
Pseudocode
variable index = Random(from numbers 0, 1, 2);
Servo[index] goes up 90°;
Loop{
variable sensVal = value from Sensor[index];
if sensVal > Threshold{
LED blink;
Score increase by 1;
Servo[index] goes down 0°;
index = new Random(from numbers 0, 1, 2);
Servo[index] goes up 90°;
}
else{
repeat getting sensVal from Sensor[index];
}
}
Flowchart
Identification of Sub-circuits
LED sub-circuit
Photoresistors sub-circuit
Servo motors sub-circuit
Comments