Arduino Button Blink

About: I like Arduino

This is my first instructable and I hope it works for all of you!

I will be teaching you guys how to make a circuit so when the button is pushed down the LED lights up!

Things needed

9 connector wires
1 button
1 Arduino
1 10k ohm resistor
1 LED (your choice of color)
1 Breadboard

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Build the Circuit

These pictures will probably sum it up for you guys

Step 2: Add the Code

Just copy and paste this code into the Arduino IDE

const int buttonPin = 2;
const int ledPin = 13;
int buttonState = 0;

void setup() {
pinMode(ledPin, OUTPUT);

pinMode(buttonPin, INPUT);
}

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

if (buttonState == HIGH) {

digitalWrite(ledPin, HIGH);
}
else {

digitalWrite(ledPin, LOW);
}}


Well that's pretty much it. Comment if you need help with something and you probably will because it's my first instructable.

Be the First to Share

    Recommendations

    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    Discussions