diff --git a/Pomodoro Timer/README.md b/Pomodoro Timer/README.md new file mode 100644 index 0000000..b686e3c --- /dev/null +++ b/Pomodoro Timer/README.md @@ -0,0 +1,47 @@ + +# Arduino Pomodoro Timer + +## Project Overview +This simple project uses an Arduino UNO to create a Pomodoro Timer with LED indicators and a buzzer. It helps users focus by timing 25-minute work sessions and 5-minute breaks. A button is used to start the timer. + +## Features +- 25-minute work session +- 5-minute break +- Buzzer alerts at transitions +- LED color changes for work/break + +## Components Required +- Arduino UNO +- Red LED +- Green LED +- Buzzer +- Push Button +- 220Ω Resistors +- Breadboard and Jumper Wires + +## Circuit Connections + +| Component | Arduino UNO Pin | +|--------------|----------------------| +| Red LED | D3 (via 220Ω resistor) | +| Green LED | D4 (via 220Ω resistor) | +| Buzzer | D5 | +| Push Button | D2 (with pull-down resistor) | + +## Working Principle +- Press the button to start a 25-minute work session (Red LED on). +- After 25 minutes, the timer switches to a 5-minute break (Green LED on). +- The buzzer alerts the user at each transition. +- After the break, the session ends and the system resets. + +## Usage Instructions +1. Connect all components according to the table above. +2. Upload the `pomodoro_timer.ino` sketch to your Arduino UNO. +3. Open the Serial Monitor (9600 baud) for status messages. +4. Press the button to start the Pomodoro timer cycle. + +## Author +Created by [KappaNone](https://github.com/KappaNone). + +## License +This project is open-source and available for educational and personal use. diff --git a/Pomodoro Timer/pomodoro_timer.ino b/Pomodoro Timer/pomodoro_timer.ino new file mode 100644 index 0000000..69c8015 --- /dev/null +++ b/Pomodoro Timer/pomodoro_timer.ino @@ -0,0 +1,77 @@ +// Arduino Pomodoro Timer Project +// Description: +// +// Arduino Pomodoro Timer +// +// Project Overview +// This simple project uses an Arduino UNO to create a Pomodoro Timer with LED indicators and a buzzer. It helps users focus by timing 25-minute work sessions and 5-minute breaks. A button is used to start the timer. +// +// Features +// - 25-minute work session +// - 5-minute break +// - Buzzer alerts at transitions +// - LED color changes for work/break +// +// Components Required +// - Arduino UNO +// - Red LED +// - Green LED +// - Buzzer +// - Push Button +// - 220Ω Resistors +// - Breadboard and Jumper Wires +// +// Circuit Connections +// Component Arduino UNO Pin +// Red LED D3 (via 220Ω resistor) +// Green LED D4 (via 220Ω resistor) +// Buzzer D5 +// Push Button D2 (with pull-down resistor) +// + + +const int redLED = 3; +const int greenLED = 4; +const int buzzer = 5; +const int button = 2; + +bool running = false; +unsigned long startTime = 0; +const unsigned long workTime = 25UL * 60 * 1000; // 25 minutes +const unsigned long breakTime = 5UL * 60 * 1000; // 5 minutes + +void setup() { + pinMode(redLED, OUTPUT); + pinMode(greenLED, OUTPUT); + pinMode(buzzer, OUTPUT); + pinMode(button, INPUT); + Serial.begin(9600); +} + +void loop() { + if (digitalRead(button) == HIGH && !running) { + running = true; + startTime = millis(); + digitalWrite(redLED, HIGH); + Serial.println("Work started"); + tone(buzzer, 1000, 500); + delay(500); + } + + if (running) { + unsigned long elapsed = millis() - startTime; + + if (elapsed >= workTime && elapsed < workTime + breakTime) { + digitalWrite(redLED, LOW); + digitalWrite(greenLED, HIGH); + Serial.println("Break started"); + } + + if (elapsed >= workTime + breakTime) { + digitalWrite(greenLED, LOW); + tone(buzzer, 1500, 500); + running = false; + Serial.println("Session complete"); + } + } +}