Touch-contact hit lights
Two players each guard a foil target pad and carry a lead with a foil tip. Touching the other player's pad closes a circuit, a coloured LED and a beep show who scored, and a short lockout makes one touch count once. First to five wins.
Build it step by step
0 of 6 doneMake the pads
Cover two pieces of card with foil, one for each player, and run a wire from each to D2 and D3.
Make the tips
Wrap foil round the end of two long wires and connect the other ends to GND.
Wire the lights and buzzer
Green on D5, red on D6, each through 220 ohms, and the buzzer on D8.
Upload the sketch
Open the Serial Monitor at 9600 baud.
Touch pad B with tip A
Green lights, the buzzer beeps and A gets a point.
Play to five
The winner's light flashes and the game stops until reset.
How do you build a touch-contact hit lights?
Two players each guard a foil target pad and carry a lead with a foil tip. Touching the other player's pad closes a circuit, a coloured LED and a beep show who scored, and a short lockout makes one touch count once. First to five wins. You need Arduino Nano, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, Active buzzer 5 V, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 110 minutes.
- Level
- Beginner
- Time
- About 110 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- SemiconductorsBuyLED 5 mm red × 1
- SemiconductorsBuyLED 5 mm green × 1
- PassivesBuyResistor 220 Ω × 2
- Motors & ActuatorsBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Player A target pad | Nano D2 | Input with the internal pull-up (scores for B when touched) |
| Player B target pad | Nano D3 | Input with the internal pull-up (scores for A when touched) |
| Player A tip lead | Nano GND | Touching B's pad connects it to ground |
| Player B tip lead | Nano GND | Touching A's pad connects it to ground |
| Green LED long leg | Nano D5 through a 220 ohm resistor | A scored |
| Red LED long leg | Nano D6 through a 220 ohm resistor | B scored |
| Both LED short legs | Nano GND | Common ground |
| Active buzzer plus | Nano D8 | Beep (minus to GND) |
Code
Each target pad is a piece of foil on card wired to an input pin that is held high by the internal pull-up. Each player's tip lead is wired to ground, so touching the other player's pad pulls that pin low and the sketch gives a point to the toucher. Green means A scored and red means B scored. After a point the board waits one second, which stops a long touch from counting more than once, then listens again. The first player to five points wins, the winner's light flashes and a long beep sounds, and the Nano reset button starts a new game. The whole game runs at five volts from USB with no sharp parts, but keep the buzzer at a comfortable distance from ears and use the game with children only with an adult nearby.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Touch-contact hit lights, first to five wins.
// Each target pad reads LOW when the opponent's tip (wired to GND) touches it.
const uint8_t PAD_A = 2; // A's pad: a touch here scores for B
const uint8_t PAD_B = 3; // B's pad: a touch here scores for A
const uint8_t LED_A = 5; // green: A scored
const uint8_t LED_B = 6; // red: B scored
const uint8_t BUZZER = 8;
const uint8_t WIN_SCORE = 5;
const unsigned long LOCKOUT_MS = 1000;
uint8_t scoreA = 0;
uint8_t scoreB = 0;
bool over = false;
void beep(unsigned int ms) {
digitalWrite(BUZZER, HIGH);
delay(ms);
digitalWrite(BUZZER, LOW);
}
void flash(uint8_t pin, uint8_t times) {
for (uint8_t i = 0; i < times; i++) {
digitalWrite(pin, HIGH);
delay(150);
digitalWrite(pin, LOW);
delay(150);
}
}
void report() {
Serial.print("A ");
Serial.print(scoreA);
Serial.print(" B ");
Serial.println(scoreB);
}
void setup() {
pinMode(PAD_A, INPUT_PULLUP);
pinMode(PAD_B, INPUT_PULLUP);
pinMode(LED_A, OUTPUT);
pinMode(LED_B, OUTPUT);
pinMode(BUZZER, OUTPUT);
Serial.begin(9600);
Serial.println("Touch game ready. Press the Nano reset button to start a new game.");
report();
}
void loop() {
if (over) return;
if (digitalRead(PAD_B) == LOW) { // A touched B's pad
scoreA++;
digitalWrite(LED_A, HIGH);
beep(200);
delay(LOCKOUT_MS);
digitalWrite(LED_A, LOW);
report();
} else if (digitalRead(PAD_A) == LOW) { // B touched A's pad
scoreB++;
digitalWrite(LED_B, HIGH);
beep(200);
delay(LOCKOUT_MS);
digitalWrite(LED_B, LOW);
report();
}
if (scoreA >= WIN_SCORE) {
flash(LED_A, 6);
beep(800);
Serial.println("Player A wins");
over = true;
} else if (scoreB >= WIN_SCORE) {
flash(LED_B, 6);
beep(800);
Serial.println("Player B wins");
over = true;
}
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Touch game ready. Press the Nano reset button to start a new game. A 0 B 0
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Touch pad B with tip A | Green, A plus one |
| Touch pad A with tip B | Red, B plus one |
| Hold the touch for three seconds | Only one point |
| Reach five points | Winner flashes, long beep |
| Press Nano reset | Scores back to zero |
If it does not work
Scores with no touch
Keep the pad wires apart and check for loose strands.
No score on touch
Press the foil flat and check the tip lead goes to GND.
Both score together
The two pads are touching each other.
No beep
Check the buzzer is the active type and the plus wire is on D8.
Serial shows nothing
Set 9600 baud in the monitor.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the touch-contact hit lights?
Arduino Nano, LED 5 mm red, LED 5 mm green, Resistor 220 Ω × 2, Active buzzer 5 V, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the touch-contact hit lights take to build?
About 110 minutes for a beginner maker, in 6 steps.
How do I know the touch-contact hit lights works?
Touch pad B with tip A: Green, A plus one. Touch pad A with tip B: Red, B plus one. Hold the touch for three seconds: Only one point.
Scores with no touch: what should I check?
Keep the pad wires apart and check for loose strands.
No score on touch: what should I check?
Press the foil flat and check the tip lead goes to GND.
Both score together: what should I check?
The two pads are touching each other.
No beep: what should I check?
Check the buzzer is the active type and the plus wire is on D8.
