User Tools

Site Tools


digispark:tutorials:button

This is an old revision of the document!


Button Shield Kit Tutorial

Product Description:

button1.jpgbutton4.jpg

This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.

Parts:

Part Quantity Identification
Button Shield PCB1
10k ohm 1/4 W resistor 1% or 5%1 Brown - Black - Orange
12x12mm tactile momentary button1
1×40 pin male 0.1“ pitch header 9 pins worth

Resistor Values: For more information on how to identify the value of the resistors, we recommend these sites: A nice simple resistor calculator: http://www.ealnet.com/m-eal/resistor/resistor.htm A comprehensive article on identification: http://www.diyaudioandvideo.com/Electronics/Color/

Soldering: If you are new to soldering we recommend the following tutorials: Soldering Basics (http://www.sparkfun.com/tutorials/106) and Soldering Crash Course from the folks at Sparkfun (http://www.sparkfun.com/tutorials/354). How to solder from the Curious Inventor: http://store.curiousinventor.com/guides/How_to_Solder

Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://learn.adafruit.com/adafruit-guide-excellent-soldering)

We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!

Assembly:

Empty kit bag (or if using a raw PCB, acquire parts) and verify contents.

button1.jpg

Insert the resistor through the top and solder on bottom of board. Cut excess leads.

button2.jpg

Insert button on top and solder four leads on the bottom.

button3.jpg

Cut a length of male headers 6 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.

Tip: Inseting the headers into a breadboard and then placing the board on top can make this process easier.

Note: If you are using stackable headers, use them here instead of the standard male headers.

button4.jpg

button5.jpg

Your Button shield is complete!

Programming:

void setup() {
    // Initialize the LED pin as output
    pinMode(1, OUTPUT);
 
    // Initialize the LED pin as input
    pinMode(5, INPUT);
 
}
 
void loop() {
    if(digitalRead(5)==LOW)
        digitalWrite(1, HIGH);  // Turn the LED on when pressed
    else
        digitalWrite(1, LOW);   // Turn the LED off when not pressed
 
}
digispark/tutorials/button.1416869520.txt.gz · Last modified: 2014/11/24 14:52 by digistump