The MakerShield is a great prototyping shield but the button can be a little confusing to use. Since it connects to ground when pressed, it takes a little extra wiring and one change in the code to get to work with with the Arduino example sketch. Follow along!

What will the next generation of Make: look like? We’re inviting you to shape the future by investing in Make:. By becoming an investor, you help decide what’s next. The future of Make: is in your hands. Learn More.

Project Steps

First, let’s lay out our parts. You’ll need a MakerShield (assembled), a mini breadboard, an Arduino, 3 male jumper wires, and a 10K Ohm (Brown, Black, Orange) resistor.

Next, take your MakerShield (with mini breadboard attached) and place it on top of the shield headers. Make sure the pins are lined up and press it into place.

Great Job! Let’s continue.

Now for the parts. Take your 10K Ohm resistor (Brown, Black, Orange) and insert one leg into the 5V pin on the MakerShield. Connect the other leg to an adjacent hole on the breadboard.

The reason we’re doing this is to give the digital input pin something to sense. This will supply the voltage we need to let the input pin know that something is going on.

Next, take a jumper wire and insert one end into the breadboard right above the resistor (just like in the picture). Connect the other end of the wire to the BTN1 (button 1) pin on the MakerShield.

Now, grab another jumper wire and stick one end into the breadboard above the other jumper wire. The other end of this jumper wire will go to the D2 (digital 2) pin on the MakerShield.

This wire is so that the Arduino will be able to detect when the button is pressed.

Now we are going to connect the LED on the MakerShield to the LED output pin.

Take another jumper wire and connect one end to the LED1 pin on the Maker Shield. Connect the other end of the jumper wire to pin D13 (digital 13) on the MakerShield.

Now the LED is connected so we’ll be able to see when the button is pressed.

Go ahead and plug your Arduino into your computer using the USB port and fire up the Arduino software.

Open the Button example sketch by going to File > Examples > Digital > Button.

Got it? Good! This sketch is written for a button that is connected to voltage on one end and a digital pin on the other. The button on the Maker Shield is different; the button connects to ground when pressed. Because of this we need to make one little change to the code.

Scroll down to where it says if (buttonState == HIGH) { (highlighted in the picture) and change HIGH to LOW.

The line should now read if (buttonState == LOW) {

What we just told the code that when the button is pressed on the Maker Shield (when the digital pin gets connected to ground) to light the LED up.

Now upload the code to your Arduino and hit the button on the MakerShield. The LED should light up!

Congratulations! Your button now works!

You can easily swap which LED lights up by switching your LED jumper wire from LED1 to LED2.

Play around and have fun!

Conclusion

Easy, huh?