Added: 3 years ago
From: makemagazine
Views: 113,764
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (215)

Sign In or Sign Up now to post a comment!
  • The thing is. That resistor isn't connected to anything until the button is pressed. Unless it's moved to the same row as the 5v pin, it does nothing. Plus, you don't need to keep a circuit closed when reading a high/low signal.

  • @TakronRust Well if the circuit isn't closed, won't you be reading a floating pin ? O and the resistor is connected to pin 2, so that pin is tied to ground when the button isn't pushed and you will get a digital 0 if you read the sate of that pin from the arduino.

  • I've always wondered why resisters where connected to buttons, now I know.

  • what resistor do you use for the button

  • @oscomputertricks 10K Ohm

  • I'm very high now!

  • Your intro with the maker shed thing is annoying, shitty, and the volume is way to high. Remove that shit.

  • Val is HIGH

  • Why wouldnt you make Button click ON no button click off..

    Haha kinda made me lost until i saw what u were talking about.

  • you know your shit man

  • OK this is  NOOB question... but, if the electricity is lazy and does not flow through the resistor on its way to pin2 from 5V, then why do we need a resistor?

  • @iluomo69 We need a bridge to ground it, but we don't want electricity to always go there. The button pressed down has a higher resistance than plain wire, so the electricity would still go to ground. We use a resistor that is higher than the pressed down button's resistance, so that it goes through the button when pressed, and through the resistor than unpressed.

  • Val's high!?!?! WAT!!!!

  • thank you..:)

  • "is it high"  on what 5 volts pssch

  • electricity is lazy -_-

  • @lolypopboy777 that's exactly how they explained it to me in physics class at school :D

  • Can you please explain again why you used the resistor in the push button?

    Thanks in advance.

  • @im18andu with the button's signal, you can't have it just not connected to anything to get a low signal - it needs to touch ground or +5v, no other way. So the resistor is used because when the switch is off, it'll get fed the 0v through the resistor, and when it's on and the 5v is flowing on that pin, there's not just a flow right from 5v into ground. That would be a "short circuit" which is a bad thing that can fry most stuff - so we use a resistor.

  • @TCinker Thank you very much! Now i get it! It acts as a stabilizer preventing random inputs into the pin due to interference from other wires and electromagnetic fields. Right?

  • OK for any one who can solve this, I have done EVERYTHING as explained here in this and one other tutorial. Here's my problem, even with the button UNPLUGGED and NO wires for the button, my LED still has a mind of its own and blinks as it pleases. Is my board just broken? I have copied and pasted all of these different programs exactly and I always get the same-ish result.

  • Comment removed

  • Well explained

  • what is the resistor from the botton to the grnd?????

  • @pintoworks its a pull down resistor

  • I am kinda confused..if you don't press the button, its like an open circuit, so how is the current flowing through the resistor to ground?

  • this is very useful for super beginners like me! thank you very much! (i've been watching videos on arduino for a few days, still waiting for the package to arrive..)

  • pen13? what about pen15?

  • I might be wrong, but I think your explanation for the button-resistor isn't correct. As I see it, the resistor doesn't carry any current when the button isn't pressed, it just connects the input pin to ground, making sure it gets a proper LOW signal, when the button is not pressed.

    When the button is pressed, it does carry a (almost all) current and makes sure that the input pin reads 5V. I would guess that the input resistance of the digital input pin is far higher than the external resistor.

  • One of the most simple projects

    Most wire and components

    quite a mess

  • thats crap though! the input pin doesnt output a voltage! its just an input!

  • @ryanstewart86 iis only input when told in programing it is in or out

  • @kyCap222 yeh but its set as an input, once its set as an input it wont output a voltage, but i understand now why it leads to ground because otherwise the pin will be floating high when the button is let go it will give false readings

  • Thank you very much, very helpful video!

    It might be a stupid question, but how do you know when to use which resistor?

    I know about Ohm's law, but I don't know how I can measure the current flow...

    Since you need two of the three parameters which occur in Ohm's law, and the resistance is a variable, so i'm kinda stuck....

    Hope you can help me,

    Cheers, Yuran=)

  • @smokesometea Based on the paramenters of the LED you're using. Say you're using a red LED. A red LED has a forward voltage (Vf) of 1.7V. Let's also say your particular model is rated at 20mA (Imax) (it will say something to the effect of 20mA@1.7V). Then finding your resistor is simply (Vdd - Vf)/Imax. If you're running at a 5V supply then it's (5-1.7)/0.02 = 3.3/0.02 = 165Ω. The power consumed by a resistor is I^2*R = 0.02*0.02*165 = 66mW; so in this case even an 1/8W resistor is OK

  • @ajm5636 sorry for the late reaction.

    Thanks for your explanation, i get it now:)

  • is that a 1/2 or 1/4 watt resistor?

  • wait, what about the built in button? if you know please reply!

  • @the1stbuilder65 that one just for reset the arduino :)

  • @oqla2000 oh, thanks for answering that, i have an arduino in the mail, cant wait!

  • This sounds stupid but how would you use 2 buttons? Because both of the input pins have to go to ground but that means the have to be connected, so when one is on, both are on.

  • @mtdeezy Because ground is "end of the line" for the current.

    Imagine that each button is a sink, each with a faucet (+5V) and a drain. Both drains are connected to the sewer (ground). If you open the faucet on one of the sinks, the water flows down the drain and into the sewer, but it's not going to flow from the sewer up through the drain of the other sink.

    Think of the input (+) voltage as the water supply and the ground (-) as the sewer, you'll find circuits a lot easier to follow.

  • IR LED?

  • ME && VAL ==HIGH

  • where is the debouncing video

  • So what would happen if you didn't add the resistor to the button, and just put the 2 wires to the button?

  • @MattFenner23 You'd probably blow something.

  • @Nadrealis From what i now understand, is that if the pin to the button is just going to nothing (not connecting back to ground) then you wont get a LOW signal instead you will get signal that is noisy (i.e. flipping between high and low). so the resistor gives it a path to ground (LOW) when it can't go the other way to 5V

  • @MattFenner23 Sorry I thought it said LED lol. Yeah, the circuit just wouldn't be read because there is no ground.

  • Terrible presentation, should've done a take two.

  • @mcguiganjohn86 why don't you make one yourself then...

  • electricity flows from negative to positive! dont teach people how to make electronics if you put the resistors on the wrong side. in this circuit it wont burn out the led but on a bigger circuit where there is more componenets your leds stand the chance of burning out.

  • @Wortelbed ....Please take some electronics courses. Yes, electrons DO flow from negative to positive, but the science was created a long time ago and it would take too much time and effort and money to redo all the teaching that has been done. In schematics, we do it positive to negative, even though electricity DOES flow from negative to positive don't try to tell people he's doing shit wrong when he isn't.

  • The Resistor at the Switch is called a PULL DOWN RESISTOR since it pulls down the voltage level of Pin2 to 0V as long there is no other (stronger) voltage source.

  • No girlfriend I take it. Well Pal good luck playing with your button.

  • lol electricity is lazy but it still always wanna go somewhere

  • This is the video that got me started with Arduino almost a year ago and I can't believe how much I've already done with my Arduinos since then! (see some of my videos for examples)

  • 12 MIN LONG VIDEO TO ADD A BUTTON dam noobs it takes no more then 40 secs if ur pro

  • @dylbyl1234 you're fucking stupid. He explained how it works, and how the code works, it wasn't a goddamned speed test.

  • @MASTERCON12 Dude why you getting insane online? Use the button and push off! You might want to get some medical attention for the explosive temper.

  • @silverpizza100 You're making literally useless comments, and you missed the point of literally every single one you replied to. Good job, bro!

  • @dylbyl1234 ..and it takes 1 second, to write "you're" instead of "ur".

  • u rock!!!! i am learning ardurino now

  • is this programmed in c++ or java, i cant tell.

  • @The1mM0RtA1

    It is programmed in C

  • @Swedezor Yeah useless C ! Couldnt use JAVA,,,Great !

  • @silverpizza100 , if you WOULD be a real coder, you would not saying something like that.

  • OMG!!! you don't need arduino to make and LED with a button...who would want to spend money on this...i would rather buy LED and button...for less than $2.00

  • @MultiCreek You missed the point. This was an introduction to inputs and outputs. Would you have taught inputs and outputs another way? I don't think so, as this is the simplest and easiest way.

  • @dag101101 If you know so much why not make your own video?

  • If the button interrupts the connection between input(slot 2) and the +5v, Would'nt the program read LOW(as the button state) anyways without the Resistor connected to the ground, since it doesn't connect to the 5v ? If you have the answer please reply via e-mail im a bit lost :)

  • @ipodmacguru All the coding? It's almost exactly like C++. Very simple, logical, and fun. Except when a compiler error occurs ;D. I am yet to buy the Arduino with ProtoShield! How exciting!

  • @HabZbaH Anything with a higher resistance than the jumper wire itself will do. As he said, electricity will flow through the path with the least resistance. In all cases, any resistors would do fine.

  • will a 330 resistor work fine?

  • Have you tried using screen capture software, its much easier than using a camera to record it, PM me if you are interested

  • @ipodmacguru Thats not the point! This is introducing you to arduino... You use your 555 timer to control a servo wit a potentiometer! Yeah, you cant! Why? Because Arduino Rocks!

  • k im very very new with this stuff but what does a resister do?

  • @timboiscool resists, the flow of electrons through the wire/

  • hi dis is anurag frm India bangalore.. i would lyk 2 do a projct usin arduino.. cn u tell me if it is availabl in india and in future videos cld u show how to control the speed of a dc motor usin arduino and usin it by a rf remote control plzzzz...

    it'll b a grt help!!

  • Eww mac....

  • @DJLstudios2425 because this is a begginer tutorial you could do that but what if you wanted to use the button to start a sub program

  • the resistor not needed..

  • @playfsx  The resistor are indeed needed... if its not there, the button will short-circuit +5 volt directly to 0v / ground and draw unlimited current, basically destroying the powersupply....

  • why use a program when you can directly connect the button to the led????

  • This video was intended to show the concept of interfacing a button and the Arduino. The LED can be replaced with a wide array of other objects.

  • its momentary so the program makes it not momentary and something called latching

  • This was explained very well. Ty

  • I bet u could attach a speeker too, then it would be like a game show buzzer only really-really small!!

  • Just got my Arduino and first day of playing with it am able to do fun stuff like you are showing! Thanks for your videos...they are tremendously useful!

    The few days I've been researching basic electrical circuits are now coming together!

  • these vids make me even more confysed

  • What are you confused about? Maybe I can help.

  • im trying to find out what im confuzed about too

    i forgot now

  • Modify one line of code and you have a push on push off button, all in software.

  • so how do you do that

  • whenever i push the button it shuts off my arduino mega :(

  • nooows you use a mac

  • you explain realy well, thanks, but this seems overkill for turning an led on and off

  • It's really not about the LED, it's more about showing you how to begin to use the arduino.

  • do you need to solder the protoshield? i got my duemilanove today and id love to get the protoshield, but i am inexperienced at soldering

  • no you can use a breadboard with it... see his other video's there is the protosheild with a breadboard in some.

  • actually he used it that way in this video too lol

  • I don't have an arduino, i'm getting one, but to my knowledge i think the protosheild just plus into all the sockets on top of the arduino.-

  • Get the protoshield anyway; I've never soldered anything before ( except a single TrippyLight) and I was able to solder my protoshield together succesfully ... just have someone show you the basics and work slow and careful.

  • Comment removed

  • Nice tutorial.

    Could you give some information about the "debouncing" you mention?

  • I think I'm gonna buy one

  • its so you don't blow the arduino

    it takes about 4v so if 5v went straight into it

    the chip would blow

  • shouldn't the resistor be between the 5v and pin 2 then? It seems to me like it's just restricting the flow from 5v to ground, and as he says in the video "electricity is lazy" so it would prefer the path directly to pin 2, with all of the 5v going directly to pin2. And as mentioned in earlier comments, the switch is a normally open switch, so there would not be any flow through it when it's not pressed. Thereby the path to the resistor is cut. Other than that it's a great video.

  • can someone explain the me why you need to connect a resistor from the button to ground? wouldn't the pin 2 read low if the resistor isn't there because the switch is stoping the 5v to go to pin 2

  • In a digiatal circuit think of it this way LOW = GROUND (not "open"), HIGH = +VOLTAGE

    The resistor is NOT there because the "chip can't handle +5v". It has another purpose and the person in the video does try to explain it.

    So, to get a 'digital read' on pin 2... pin 2 must be connected to GROUND to read LOW. (Open will not read as 'LOW' to the digital circuit... in fact.. I'm not entirely sure what it would do but it wouldn't necessarily do what you want..)

  • If you connect Pin 2 to ground with a wire (instead of a resistor) It will still read LOW to the digital circuit, but the problem is, when you press the button, connecting the +5v to the mix, the electricity would want to flow right to ground through the switch. Again, I'm not sure what might be read at the digital Pin 2 at this point, but it wouldn't be desired.

  • So, the resistor is there to to stop the +% from going straight to ground when you press the button... instead i wants to go to Pin 2, where it will be read as HIGH.... the desired result.

    It is a little confusing, but the video is correct.

  • wait... at the end, at 11.43 he has a different arduino schematic as before. really, i'm not kidding!!! why is it different? he did something wrong or what?? if so, he's not that smart...

  • yes but he says that you can put that resistor in two pins the first one and then after at 11:43...he said it is all same but he put it different to make it better to see look at 3:30

  • i agrree with you

  • OMG i do not know anything man

    what did u study in ur college?!!

  • lol lazy electricity

  • Subscribed! I really want an Arduino. More Movies!

  • MORE ARDUINO TUTORIALS!

    GOOD JOB!

  • is the resistor a 1k?

  • yah

  • wie heist das Program ?

    what is the name of the Program?

  • should I do computer engineering or computer science for more stuff like this??

  • computer engineering would encompass both software and hardware, while computer science is only the software (code). im in comp.engineering, and while it is difficult, there are times where it is a ton of fun

  • thanks, that helped a lot :D

  • did he just use a 1% tolerance resistor for the pull-up switch?! Not that it's wrong... but that's a little overkill...

  • I like this little Arduino Gizmo , its good for getting used to the c++ language.

  • i use the ==, += and -= for garrys mod scripting (used for button fuctions, movement of constraints, lights, ect.)

  • tea i think this is a truely bad video it make a simppple thing connecting a led to a switch sound like rocket science - my head nearly exploded watching it!!

    Trry and redure it to 90 seconds.

  • dont watch the channel then fuck wit

  • now whats the purpose of the protoshield?

  • the purpuse is that it has a breadboard..

  • Makes connecting things less permanent and easier. Hence the name Proto (protoype) shield (cause it shields the arduino unit)

  • I really liked 200 n 1 electronic kits from Radio Shack Amazon has them now from elenco for like $30

    breadboarding is really pleasant Get a little breadboard from Radio Shack

  • This is awesome with a switch plus light under software control you could measure hamster wheel turns n turn the light on to do learning things

    with a photodetector detecting plant height you could automatically vary lighting to see how light period changes plant growth automatically under software control as software varies lighting period

    it would be fun to swap a photodetector with the switch then tape the photodetectoron the computer screen to make feedback; software does rate

  • please do more this one was awesome but i want more

  • Awesome tutorial, Just completed it :) Very fun, and well done!

  • electricity is lazy! finally something we have in common.

  • well i was bored before and after watching tjhis video it gave me some entertaintment and encouraged me to keep watching haha :] nicely done.

  • CRumbs I could have connected a LED to a button in about 20 seconds ot 12 minutes!!

  • This video takes foreverrrrrrrrrrrr

  • What program is that? C++? or what?

  • I do think so... not entirely sure

  • c++ isnt a program. It's a language. The program is the arduino program.

  • sooo beginner.. I was thinking about EE whats the hardest stuff you have to learn?

  • Nicely done !! Looking forward to your next one. Don't forget us.

  • The best Arduino tutorial I have seen is on the Adafruit web site. It's not a video, but it is the clearest I've found. For example, NOBODY else explains why setup and loop have the word "void" in front of them. That was driving me crazy! I have nothing to do with Adafruit, but Arduino newbies should check it out.

  • use an internal weak pullup on the pin and save a resistor

    turn it on when pulled low

  • Comment removed

  • then dont watch it... i found it quite interesting

  • cant wait for your next video~! nicely done

  • ok, you completely lost me when you where talking about input, output, digital read... im getting dizzy thinking about it T_T

  • well i hope pin 2 isnt high

    lol...if it is high wat drug did it use

  • omg my head just exploded

  • Your explanation of how the button works is very, very wrong!!!!!!!! Not pushed = no voltage at resistor, which is then sampled by pin 2. Pushed = 5v at resistor, which is then sampled by pin 2.

  • Comment removed

  • Following up my own post: Pin2 is an INPUT. There is no current flowing from it, contrary to what you say in your video.....

  • yea....

  • agrred

  • shouldnt u be teaching debouncing as well?

  • YAY! 100TH RATING!

  • i CANNOT believe i just did that

  • Kipkay and you are awesome

  • nice man, very well explained, keep it up!

  • Kipkay goes right to the experiment with no explanation, this guy is awesome because he explains how things work. I like his style, keep it up.!!!!

  • wtf

  • i learned how to do this kind of stuff in tech

  • 4,000's view yeah. good video!

  • Kipkay is so much better than him...

  • but, bre was the best lol

  • i didnt get the video