Devices & Components
Arduino Uno Rev3
Solid State Relay
Slide Switch
Resistor 220 ohm
LED Light Bulb, Cool White
Buzzer
Jumper wires (generic)
Breadboard (generic)
Rotary potentiometer (generic)
DC Motor, Miniature
Alphanumeric LCD, 16 x 2
Software & Tools
tinkercad
Arduino IDE
Project description
Code
Untitled file
c_cpp
1#include <LiquidCrystal.h> 2LiquidCrystal lcd1(13, 12, 11, 10, 9, 8); 3LiquidCrystal lcd2(7, 6, 5, 4, 3, 2); 4int push_button = A0; // select the input pin for switch 5int minutes; 6int seconds; 7int updated_minutes; 8int updated_seconds; 9int button = 0; // variable to store the value coming from the sensor 10int timer_time; 11int duration; 12void setup() 13{ 14Serial.begin(9600); 15lcd1.begin(16, 2); 16lcd2.begin(16, 2); 17pinMode(A3, OUTPUT); 18pinMode(A4, OUTPUT); 19pinMode(push_button, INPUT); 20pinMode(A1, INPUT); 21pinMode(A2, INPUT); 22} 23 24void loop() 25{ 26digitalWrite(A3,LOW); 27digitalWrite(A4,LOW); 28button = digitalRead(push_button); 29timer_time = analogRead(A1); 30timer_time = timer_time/20; 31duration = analogRead(A2); 32duration = duration/20; 33Serial.print("Timer time = "); 34Serial.println(timer_time); 35Serial.print("Duration = "); 36Serial.println(duration); 37lcd2.setCursor(0,0); 38lcd2.print("Timer Time "); 39lcd2.setCursor(13,0); 40lcd2.print(timer_time); 41lcd2.setCursor(0,1); 42lcd2.print("Duration "); 43lcd2.setCursor(13,1); 44lcd2.print(duration); 45delay(400); 46lcd2.clear(); 47 if(button == HIGH ) 48 { 49 digitalWrite(A4, HIGH); 50 for(minutes=0;minutes<timer_time;minutes++) 51 { 52 lcd1.setCursor(0,0); 53 lcd1.print("My Timer:- "); 54 lcd1.setCursor(11,0); 55 lcd1.print(minutes); 56 lcd1.print(":"); 57 for(seconds=0;seconds<=59;seconds++) 58 { 59 lcd1.setCursor(13,0); 60 lcd1.print(seconds); 61 delay(1000); 62 63 } 64 lcd1.setCursor(11,0); 65 updated_minutes = minutes+1; 66 lcd1.print( updated_minutes); 67 lcd1.print(":"); 68 updated_seconds = seconds-59; 69 lcd1.setCursor(13,0); 70 lcd1.print(updated_seconds); 71 digitalWrite(A3, LOW); 72 digitalWrite(A4, HIGH); 73 lcd1.clear(); 74 } 75 for(seconds=duration;seconds>=0;seconds=seconds-1) 76 { 77 lcd1.setCursor(0,0); 78 lcd1.print("Duration: "); 79 80 lcd1.setCursor(11,0); 81 lcd1.print(seconds); 82 digitalWrite(A3, HIGH); 83 digitalWrite(A4, LOW); 84 85 delay(1000); 86 87 } 88} 89else 90{ 91digitalWrite(A3, LOW); 92} 93}
Untitled file
c_cpp
1#include <LiquidCrystal.h> 2LiquidCrystal lcd1(13, 12, 11, 10, 9, 8); 3LiquidCrystal lcd2(7, 6, 5, 4, 3, 2); 4int push_button = A0; // select the input pin for switch 5int minutes; 6int seconds; 7int updated_minutes; 8int updated_seconds; 9int button = 0; // variable to store the value coming from the sensor 10int timer_time; 11int duration; 12void setup() 13{ 14Serial.begin(9600); 15lcd1.begin(16, 2); 16lcd2.begin(16, 2); 17pinMode(A3, OUTPUT); 18pinMode(A4, OUTPUT); 19pinMode(push_button, INPUT); 20pinMode(A1, INPUT); 21pinMode(A2, INPUT); 22} 23 24void loop() 25{ 26digitalWrite(A3,LOW); 27digitalWrite(A4,LOW); 28button = digitalRead(push_button); 29timer_time = analogRead(A1); 30timer_time = timer_time/20; 31duration = analogRead(A2); 32duration = duration/20; 33Serial.print("Timer time = "); 34Serial.println(timer_time); 35Serial.print("Duration = "); 36Serial.println(duration); 37lcd2.setCursor(0,0); 38lcd2.print("Timer Time "); 39lcd2.setCursor(13,0); 40lcd2.print(timer_time); 41lcd2.setCursor(0,1); 42lcd2.print("Duration "); 43lcd2.setCursor(13,1); 44lcd2.print(duration); 45delay(400); 46lcd2.clear(); 47 if(button == HIGH ) 48 { 49 digitalWrite(A4, HIGH); 50 for(minutes=0;minutes<timer_time;minutes++) 51 { 52 lcd1.setCursor(0,0); 53 lcd1.print("My Timer:- "); 54 lcd1.setCursor(11,0); 55 lcd1.print(minutes); 56 lcd1.print(":"); 57 for(seconds=0;seconds<=59;seconds++) 58 { 59 lcd1.setCursor(13,0); 60 lcd1.print(seconds); 61 delay(1000); 62 63 } 64 lcd1.setCursor(11,0); 65 updated_minutes = minutes+1; 66 lcd1.print( updated_minutes); 67 lcd1.print(":"); 68 updated_seconds = seconds-59; 69 lcd1.setCursor(13,0); 70 lcd1.print(updated_seconds); 71 digitalWrite(A3, LOW); 72 digitalWrite(A4, HIGH); 73 lcd1.clear(); 74 } 75 for(seconds=duration;seconds>=0;seconds=seconds-1) 76 { 77 lcd1.setCursor(0,0); 78 lcd1.print("Duration: "); 79 80 lcd1.setCursor(11,0); 81 lcd1.print(seconds); 82 digitalWrite(A3, HIGH); 83 digitalWrite(A4, LOW); 84 85 delay(1000); 86 87 } 88} 89else 90{ 91digitalWrite(A3, LOW); 92} 93}
Downloadable files
When the duration time is on.
When the duration time is on.

When the timer is on
When the timer is on

When the timer is on
When the timer is on

Initial state of the project
Initial state of the project

When the duration time is on.
When the duration time is on.

Comments
Only logged in users can leave comments