กลับไปหน้ารวมไฟล์
circuit-completion-game-with-buzzer-d6c3ca-en.md

Physical Dexterity: Circuit Completion Buzz-Wire

The classic "Don't touch the wire" carnival game is fundamentally a lesson in creating an intentional electrical short-circuit. The Circuit Completion Game expands upon that simple concept. It doesn't just buzz; it tracks player lives, times their execution speed using the millis() clock, and mathematically ranks their hand-eye coordination natively on an Arduino!

button_led_basic_interaction_1772681969235.png

Manipulating the Electrical Short

This logic is entirely based on the INPUT_PULLUP concept.

  1. The Giant Wire Maze (The course) is physically soldered directly to the Arduino's GND pin.
  2. The Player's Metal Wand (The ring) is wired directly to Pin 2.
  3. In software: pinMode(2, INPUT_PULLUP);. The internal resistor forces Pin 2 to definitively read HIGH.
  4. The Collision Variable: The moment the player's wand accidentally touches the massive metal maze, the electrical path closes. Pin 2 instantly drops LOW.

Creating the Debounced 'Lives' System

The hardest part of this code is preventing the Arduino from counting one tiny touch as ten million failures!

  • if (digitalRead(WandPin) == LOW) { ... }
  • The Uno reads Pin 2 millions of times a second. If you touch the wire for half a second, the Uno will count 500,000 "touches" and immediately end the game!
  • The Debounce Logic: You must introduce a mathematical lockout timer.
if (digitalRead(WandPin) == LOW && (millis() - lastStrike > 1000)) { 
  // Only trigger if a full 1000 milliseconds have passed since the LAST strike!
  lastStrike = millis(); 
  lives = lives - 1; 
  tone(BuzzerPin, 200, 500); // Play an ugly 200Hz error note!
}
  • If lives == 0, the Arduino locks the game state, turns the LEDs Red, and plays a descending "Game Over" melody!

Essential Wire Game Hardware

  • Arduino Uno/Nano.
  • Massive 12 AWG bare copper wire (Bent into terrifying, twisting shapes using pliers).
  • A smaller piece of stiff metal wire formed into a loop for the player's wand.
  • A Piezo Buzzer for the auditory punishment.
  • An array of 3 Red LEDs to visually represent the player's remaining lives!

ข้อมูล Frontmatter ดั้งเดิม

title: "Circuit Completion Game with Buzzer"
description: "The steady hand challenge! Construct the classic carnival 'buzz-wire' game, utilizing floating pins and internal pull-up logic to detect microscopic metal-on-metal collision events."
category: "Gaming & Entertainment"
difficulty: "Easy"