Check out a free preview of the full Nodebots / Hardware course:
The "Wiring Up a Button" Lesson is part of the full, Nodebots / Hardware course featured in this preview video. Here's what you'd learn in this lesson:

Steve adds a button to the breadboard.

Get Unlimited Access Now

Transcript from the "Wiring Up a Button" Lesson

>> Steve Kinney: So that is again, the LED is the hello world of working with hardware. And we've solved for one direction at this point. We've solved for going from our code to control the board. What would be really interesting at this point, is to actually let our actual hardware tell our JavaScript something.

[00:00:27] So we need a way for some kind of interaction to go from the board and then do something in code. So we're gonna use a different component at this point, we'll keep the LED where it is for now, but we're gonna add another component which is called the button.

[00:00:44] And so go in and we'll actually just look at what we're going to wire up next. And so we're going to take this button component and we're gonna add it to the board RAM. Now, before I was talking a little bit about polarized and not polarized components. The button itself is not a polarized component, so which way it goes on the board, you'll see that none of the pins are longer than another pin.

[00:01:07] We don't need to do that. The other thing that we're gonna do as we go over to the board is, now I have multiple things using the ground. So I will actually use that ground rail along either the top or the bottom, whichever orientation works best for you.

[00:01:21] It doesn't really matter, the red board is symmetrical. So the very first thing we're gonna do is take that ground and move it to this ground rail right here.
>> Steve Kinney: Cool, I have a very small wire that I'm going to use, but you can use a regular size wire, but I just wanna make sure that it's easy for you to see.

[00:01:47] And I'm gonna go and kind of take the ground of the LED and go in between,
>> Steve Kinney: Cool, that's should be in. Cool, so I have a connection in between that ground and the actual LED where it was before. And that's effectively creating the same circuit that I had before, which is stopping in that middle ground rail.

[00:02:24] Next we're gonna take a button, and so there are little fun caps for the buttons, but this is effectively what a button looks like. And it has these kind of four prongs along the bottom. On the top and the bottom, so these two on the top are connected, and these two on the bottom are connected.

[00:02:42] So it's not really four prongs, it's two. And it doesn't matter, what we're gonna do is we're actually gonna put it over that channel in the middle of your breadboard. So kinda place it in like that.
>> Steve Kinney: And one thing you wanna make sure is that you didn't actually bend any of the pins.

>> Steve Kinney: We'll place that in. And so now, because it's going over the channel you could technically, it's connected to both sides of the channel in this case. But we're gonna keep everything on the one side that we have. And the first thing we'll do is we'll kind of connect it to ground again, based on the diagram.

[00:03:30] Let's actually grab a slightly smaller one.
>> Steve Kinney: And it's very important to look very closely at it. It's not necessarily the very edge of the physical button, but where the pin actually goes in. Cool, and I am off by one so I'm just gonna move my button over but it's mostly because I'm doing this at an interesting angle.

>> Speaker 2: Were you trying to line up the pins with the light?
>> Steve Kinney: I might hardwire the pins with this ground wire.
>> Speaker 2: Okay.
>> Steve Kinney: All right. So we look at the diagram, you can see that the kinda pins are slightly towards the middle and then,
>> Steve Kinney: We'll go, I'm not going to use black, black is not a great color for that.

[00:04:27] We'll actually take yellow, seems like a good color.
>> Steve Kinney: We'll go from there, and that is going. So I can leave the LED and the A5 for it, the diagram that we have is kinda back to A0. It doesn't really matter, our adjust code will have to reflect what it is.

[00:04:50] I'm going to match the diagram, just for everyone's sanity, but you can choose to leave this, it's gonna go back to A0. And then the button, there's gonna be another gap in between,
>> Steve Kinney: Along those lines.
>> Steve Kinney: Right, so we should match the diagram that we have in that directory.