Arduino Tutorial #1 - Digital Inputs and Outputs - Button & LED

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Hi,

That’s interesting buddy.

I would like too see how to on/off a led light with using a clock and time values.

Please πŸ™ƒ.

Cheers.

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/Ulysse-88 πŸ“…οΈŽ︎ Sep 19 2018 πŸ—«︎ replies
Captions
how's it going guys Vlad here and welcome to the first Arduino tutorial of a series for this particular tutorial we're going to cover the digital inputs and outputs and you're going to need your Arduino Uno you're going to need a breadboard several jumper wires a push-button an LED and a corresponding resistor in my case it's a 120 ohm so without any further delay let's get started so the Arduino itself has 13 pins which are capable of doing digital inputs and outputs they are located up here along with the ground and the a RF pen so for the first example we're going to use the thirteenth pin as long as as well as the led on the Arduino itself and for the second one we're going to choose a different pin and connect our led and the resistor to make it blink so let's get started with the software alright so in order for the LED on the pin 13 to blink we have to write a series of instructions so we're going to define our LED to be on pin 13 we're going to write a setup function which is basically a function which defines any inputs and outputs for the Arduino and you know and in our case the only pen were going to define is going to be the pin 13 so a pen 13 output we're going to create a void loop function which is going to repeat until the Arduino is powered down and in this case we're going to write a hi to the LED followed by a half of a second dollar so 500 milliseconds followed by a digital write LED low which is going to turn that off another delay of 500 milliseconds and we're going to close our loop so we need to verify the sketch and we're going to upload it to the Arduino so let's see what it does if you have done everything correctly and uploaded the sketch to the Arduino you should see the LED blink every half of a second so let's do something more complicated and instead of having this LED blink we're going to use a breadboard Billy small circuit with an LED and a resistor on it all right so for the second example what we need to do is to run two wires one from pin 12 and one from the ground pin of the Arduino onto the breadboard we're going to connect on LED in series with a resistor obviously the pen of the positive pin of the LED is going to go into pin 12 and the negative pin of the LED is going to go into the resistor and that's going to all go to the ground so we need to make a small we need to make a small modification to our program so in this case all we have to do is put pin 12 for the LED verify the sketch again and upload it to the Arduino and once we're going to build the circuit we can hook everything up and see how it looks like okay so let's build our circuit one thing to pay attention to is that the longer lead of the LED is going to go into the positive pin or the pin or the pen 12 of the Arduino so we're going to place it on the breadboard we're going to connect the n 12 to the positive lead we're going to place our resistor on the second count of the LED and we're going to plug in the ground pin into the other end of the resistor so let's hook up the power to the Arduino and see what it does as we expected the LED on the pin 12 is now blinking for the final circuit we're going to add a button tour board which is going to turn on and off the LED so let's take a quick look at how this is done first of all we're going to put it on pin 4 we're going to have a pulldown resistor to the ground notice how I broken out the ground as well as the volts onto the breadboard rails so this resistor is going to go straight to the ground to keep the pen array low and when the button is pushed is going it's going it's going to go to the 5 volts rail so it's going to toggle between 0 and 5 volts we're going to also have to modify our program to include the button so in this case we're going to add a button on pin 4 we're going to have to include an additional definition of the input so button input and what we're going to do here is replace the delays with an if statement so in this case we're going to do if digital read button and if it is equal to high so when the button is pressed we are going to turn on the LED otherwise or else the LED is going to have to be turned off so let's quickly verify the sketch see if there's any mistakes and we're going to upload it to the Arduino and let's take a look at the circuit alright so as you can see I have connected the circuit and you can see the button right below the LED it is connected through a pulldown resistor to the ground the the input the order reading on and 4 is connected to the button as well as the pulldown resistor and on the other side you have the button going to the high voltage rail so I have uploaded the sketch and let's take a look at what it does so as I push the button as expected the LED is going on and off so everything works as expected and notice that in this case we don't need any button debouncing as some of you may be familiar with the term and we're going to take a look at that in the next tutorial so please comment subscribe and let me know if you want to see some something different or some different components for the Arduino thank you very much bye
Info
Channel: EEEnthusiast
Views: 786,845
Rating: 4.8151336 out of 5
Keywords: Arduino (Computing Platform), Light-emitting Diode (Invention), Arduino Tutorial, Electronics Tutorial, Getting Started Arduino, Basic Circuits, Electrical Engineering, Electronics (Field Of Study), Tutorial (Industry), Arduino Class, Arduino Project, DIY Electronics, Beginner Electronics, Do It Yourself (Website Category), Computer, Projects, Weekend Project, Getting Started with Electronics, Computer Software, Programming, DIY
Id: YWY_Is0L7fE
Channel Id: undefined
Length: 6min 25sec (385 seconds)
Published: Wed Jan 01 2014
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.