invisiblebat537
Published © GPL3+

Simple LED Light with Button Press

When you press a button the LED light will blink as long as you pressed.

BeginnerFull instructions provided359
Simple LED Light with Button Press

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Jumper wires (generic)
Jumper wires (generic)
×4
LED (generic)
LED (generic)
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Arduino USB Cable

Story

Read more

Schematics

Arduino Schematic Diagram

Code

Arduino Project Code

Arduino
const int BUTTON = 2;
const int LED = 13;
int BUTTONstate = 0;

void setup()
{
  pinMode(BUTTON, INPUT);
  pinMode(LED, OUTPUT);
}

void loop()
{
  BUTTONstate = digitalRead(BUTTON);
  if (BUTTONstate == HIGH)
  {
    digitalWrite(LED, HIGH);
    delay(1000);
    digitalWrite(LED, LOW);
    delay(1000);
  } 
  else{
    digitalWrite(LED, LOW);
  }
}

Credits

invisiblebat537
0 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.