Digital Input Arduino
These are the steps taken to complete the Digital Input on the Arduino.
Step 1:
Things needed to complete this project:
1 LED
1 breadboard
1 Arduino
1 220 resistor
2 push switches
7 M-M jumper wires (4 black, 1 blue, 1 yellow, 1 red)
Step 2:
Place LED on line I on your breadboard, with the shorter leg on number 21 and the longer leg on number 22. This will ensure that you do not confuse the positive and negative.
Step 3:
After you have the LED placed, take your 220 resistor and insert one leg on line h number 22 of your breadboard. Then insert the other leg on line h number 26 of your breadboard. Placing the resistor on line h number 22 has it correlated with the positive leg of the LED which is what we need to complete this project.
Step 4:
Once you have completed step two take your push buttons and insert one at 30 on both sides of the breadboard. Insert the other push button at 35.
Step 5:
Next, take two of your black jumper wires and connect one of them on line h number 21. This will connect directly down to the negative column on your breadboard. Then take the second black jumper wire and connect that from the negative column on your breadboard to the GND on your Arduino.
Step 6:
Then take your red jumper wire and insert one end on line g number 26. Then insert the other end of the wire into the Arduino on number 5.
Step 7:
Take the other two black jumper wires and insert one on line c number 28 and follow the other end to the negative column. Then take the other black jumper wire and insert one end on line c number 35 and follow that one down to the negative column ad well and insert the other end of the wire.
Step 8:
Take your yellow wire and insert one end of the wire on line d number 33 and insert the other end of the wire to the Arduino on number 8.
Step 9:
Now take your blue wire and insert one end on line c number 30 and insert the other end of the wire into your Arduino on number 9.
Step 10:
Once you have completed your wire set up and made sure everything was connected correctly you are going to want to open your Arduino tab on your computer and run this code.
int ledPin = 5;
int buttonApin = 9;
int buttonBpin = 8;
void setup() {
pinMode(ledPin, OUTPUT); // the led is the output
pinMode(buttonApin, INPUT_PULLUP); // the push buttons are the input
pinMode(buttonBpin, INPUT_PULLUP); // the push buttons are the input
//default value for input is HIGH, when button is pushed input is LOW
}
void loop() {
if (digitalRead (buttonApin)== LOW)
{ digitalWrite (ledPin, HIGH);
}
if (digitalRead (buttonBpin)== LOW)
{ digitalWrite (ledPin, LOW);
}
}
Step 11:
Once you have run the code, push down on the buttons to see the output of the push buttons.
Step 12:
Here is a video!