What It Does (Yeh Kya Karta Hai?)
Yeh "Reverse Counting" project hai. Jaise NASA rocket launch karta hai: 3... 2... 1... 0 (Blast off!). Is mein hum Buzzer bhi add karein gay taake jab 0 aaye to awaaz aaye.
Components Required
-
Microcontroller: Arduino Uno
-
7-Segment Display (1 Digit, 10 Pins wala)
- Add: 1 x Buzzer (Active).
- Jumper Wires (Kam se kam 8)
Wiring (Taarein Jorna)
Step 1: Common Connection (Resistor Yahan Lagega)
Display ki Neeche wali line mein jo Beech wala Pin (Pin 3) hai:
- Us Pin se Resistor jodein.
- Resistor ka doosra sira Arduino GND mein lagayen. (Is se sab LEDs safe rahengi).
Step 2: Segments Connection (A to G)
🔻 Neeche Wali Line (Left se shuru karein):
-
Pehli Pin (E): → Arduino Pin 6
-
Dusri Pin (D): → Arduino Pin 5
-
Teesri (Common): → Yeh humne Resistor/GND se jod di hai.
-
Chothi Pin (C): → Arduino Pin 4
- Paanchvi (Dot): → Khali chhor dein.
🔺 Upar Wali Line (Left se shuru karein):
-
Pehli Pin (G): → Arduino Pin 8
-
Dusri Pin (F): → Arduino Pin 7
-
Teesri (Common): → Khali chhor dein (Neeche wali ground kaafi hai).
-
Chothi Pin (A): → Arduino Pin 2
- Paanchvi Pin (B): → Arduino Pin 3
Buzzer:
- Long Leg (+) -> Pin 10
- Short Leg (-) -> GND
Push Button
-
Button ki Aik Taang (Leg 1): Isay seedha Arduino Pin 12 mein laga dein.
- Button ki Doosri Taang (Diagonal Leg): Isay seedha GND (Ground) mein laga dein.
Code
// PlzPapa Project #34: Countdown Timer
// 9 se 0 tak ginti aur phir BLAST!
const int buttonPin = 12;
const int buzzerPin = 10;
byte numbers[10][7] = {
{1,1,1,1,1,1,0}, // 0
{0,1,1,0,0,0,0}, // 1
{1,1,0,1,1,0,1}, // 2
{1,1,1,1,0,0,1}, // 3
{0,1,1,0,0,1,1}, // 4
{1,0,1,1,0,1,1}, // 5
{1,0,1,1,1,1,1}, // 6
{1,1,1,0,0,0,0}, // 7
{1,1,1,1,1,1,1}, // 8
{1,1,1,1,0,1,1} // 9
};
void setup() {
for(int i=2; i<=8; i++) { pinMode(i, OUTPUT); }
pinMode(buttonPin, INPUT_PULLUP);
pinMode(buzzerPin, OUTPUT);
showDigit(9); // Ready position
}
void showDigit(int num) {
int pin = 2;
for(int i=0; i<7; i++) {
digitalWrite(pin, numbers[num][i]);
pin++;
}
}
void loop() {
if (digitalRead(buttonPin) == LOW) { // Start Button
// 9 se 0 tak loop
for(int i=9; i>=0; i--) {
showDigit(i);
// Har second par 'Tick' ki awaz
digitalWrite(buzzerPin, HIGH);
delay(100);
digitalWrite(buzzerPin, LOW);
delay(900); // Total 1 second
}
// 0 par pohoch gaye (Blast Off!)
for(int k=0; k<5; k++) { // 5 baar blink karega
showDigit(0);
digitalWrite(buzzerPin, HIGH);
delay(100);
// Screen OFF
for(int j=2; j<=8; j++) digitalWrite(j, LOW);
digitalWrite(buzzerPin, LOW);
delay(100);
}
showDigit(9); // Reset for next launch
}
}