https://github.com/matesoft2033/c4
The C4 - Button & Buzzer Timer is an Arduino project that simulates a timed detonation system. When the button is pressed, a countdown begins, displaying the elapsed time on the Serial Monitor. If the button is held for 10 seconds, the buzzer activates, signaling "detonation." Releasing the button at any point resets the timer.
https://github.com/matesoft2033/c4
arduino button buzzer countdown-timer diy-project electronics embedded-systems engeneering serial-monitor tech
Last synced: about 2 months ago
JSON representation
The C4 - Button & Buzzer Timer is an Arduino project that simulates a timed detonation system. When the button is pressed, a countdown begins, displaying the elapsed time on the Serial Monitor. If the button is held for 10 seconds, the buzzer activates, signaling "detonation." Releasing the button at any point resets the timer.
- Host: GitHub
- URL: https://github.com/matesoft2033/c4
- Owner: matesoft2033
- Created: 2025-03-17T16:49:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-16T23:37:40.000Z (about 1 year ago)
- Last Synced: 2025-05-17T00:28:15.955Z (about 1 year ago)
- Topics: arduino, button, buzzer, countdown-timer, diy-project, electronics, embedded-systems, engeneering, serial-monitor, tech
- Language: C++
- Homepage: https://www.tinkercad.com/things/7DUghqrBAWY-bomb?sharecode=ZM_eTnb7UmI3vdNoHgQR_0gusHznHeY6w0ev1V62lEg
- Size: 132 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 💣 C4 - Button & Buzzer Timer
The **C4 - Button & Buzzer Timer** is an Arduino project that simulates a countdown timer. When a button is pressed, it starts counting up to 10 seconds. If the button remains pressed for 10 seconds, the buzzer activates. If the button is released, the countdown resets.
## 📸 Circuit Diagram
Connect the components as follows:

- **Button** → Digital Pin 2
- **Passive Buzzer** → Digital Pin 3
- **Resistor (10kΩ)** → Pull-down for button
- **Arduino Board** (e.g., Arduino Uno)
## 🔧 Features
✅ **Countdown Timer**: Increments every second while the button is held.
✅ **Buzzer Activation**: Sounds when 10 seconds are reached.
✅ **Auto Reset**: Releasing the button resets the countdown.
✅ **Serial Monitor Output**: Displays countdown progress.
## 🚀 How It Works
1. **Press & Hold the Button**: The timer starts counting.
2. **Monitor the Serial Output**: Each second is printed.
3. **At 10 Seconds**: The buzzer turns on.
4. **Release the Button**: The timer resets, and the buzzer stops.
## 📜 Code
```cpp
#define BUTTON 2
#define BUZZER 3
#define TIME 1000
void setup() {
Serial.begin(9600);
pinMode(BUTTON, INPUT_PULLUP);
pinMode(BUZZER, OUTPUT);
}
void loop() {
int i = 0;
while (digitalRead(BUTTON) == LOW) {
i++;
Serial.print("You have pressed the button for: ");
Serial.println(i);
delay(TIME);
if (i == 10) {
Serial.println("You have pressed it for 10 seconds **BOOM**");
tone(BUZZER, 1000);
}
}
noTone(BUZZER);
}
```
## 📢 Notes
- Use **INPUT_PULLUP** to avoid floating input issues.
- Adjust the **delay(TIME)** if you need a different timing.
- The **tone() function** activates the buzzer at 1kHz.
- Ensure the **button is wired correctly** (pull-down resistor recommended).
🔥 Have fun with your C4 countdown simulation! 🔥