q1q2q3
Published

Hand Wash for 20 seconds

In this project we will use two LEDs and one push button to make this Arduino project. Enjoy !

BeginnerProtip141
Hand Wash for 20 seconds

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Resistor 220 ohm
Resistor 220 ohm
×3

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

The Schematic

Code

The Code

C#
const int buttonPin = 2;  

int buttonState = 0;      

void setup() {
  pinMode(buttonPin, INPUT);
}

void loop() {
  
  buttonState = digitalRead(buttonPin);

  if (buttonState == HIGH) {
    
    digitalWrite(13, HIGH);
    digitalWrite(12, LOW);
    delay(20000);
    digitalWrite(12, HIGH);
    digitalWrite(13, LOW);
    delay(1000);
    digitalWrite(12, LOW);
  } else {
  
    digitalWrite(12, LOW);
    digitalWrite(13, LOW);
  }
}

Credits

q1q2q3
0 projects • 0 followers

Comments