Introduction: Arduino Button Blink
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
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.
Comments
8 years ago on Introduction
Nice work!