hrsajjad844
Published © MIT

Control an LED with Switch Using Arduino

This is a basic project to Control an LED with Push-button Switch Using Arduino. Where using Arduino programming and basic circuit diagram.

IntermediateShowcase (no instructions)46,816
Control an LED with Switch Using Arduino

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
5 mm LED: Green
5 mm LED: Green
×1
Switch Actuator, Head for spring return push-button
Switch Actuator, Head for spring return push-button
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Story

Read more

Schematics

circuit diagram

Here is the circuit design

Code

Code

C/C++
Here is the project code
int swt = 13;
int led = 12;
void setup()
{
  pinMode(13, INPUT);
  pinMode(12, OUTPUT);
}

void loop()
{
  
    if(digitalRead(swt) == 1)
    {
    	digitalWrite(led, HIGH);
    }
  else{
       digitalWrite(led, LOW);
  }
    
}

Credits

hrsajjad844
1 project • 16 followers
Contact

Comments

Please log in or sign up to comment.