Introduction: Arduino Turn on Led Using Button

const int LED = 9;

const int button=2;

void setup() {

// put your setup code here, to run once:

pinMode(LED,OUTPUT);

pinMode(button,INPUT);

}

void loop() {

// put your main code here, to run repeatedly:

if(digitalRead(button) == HIGH)

{

digitalWrite(LED,HIGH);

}

else{

digitalWrite(LED,LOW);

}

}

Step 1: Connections

Picture of Connections

1. arduino uno,

2. led,

3. button,

4. some jumpers,

5. 10k resistor (optional)

Comments

wold630 (author)2016-04-21

Good work!

mehmetsukru (author)wold6302016-04-21

thank you! :)

About This Instructable

478views

9favorites

License:

More by mehmetsukru:Arduino Turn On Led using button
Add instructable to: