======Button Shield Kit Tutorial====== =====Product Description:===== [[https://s3.amazonaws.com/digispark/images/m/button1.JPG|{{https://s3.amazonaws.com/digispark/images/t/button1.JPG}}]][[https://s3.amazonaws.com/digispark/images/m/button4.JPG|{{https://s3.amazonaws.com/digispark/images/t/button4.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 PCB|1| | | 10k ohm 1/4 W resistor 1% or 5%|1| Brown - Black - Orange| | 12x12mm tactile momentary button|1| | 1x40 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. [[https://s3.amazonaws.com/digispark/images/m/button1.JPG|{{https://s3.amazonaws.com/digispark/images/t/button1.JPG}}]] Insert the resistor through the top and solder on bottom of board. Cut excess leads. [[https://s3.amazonaws.com/digispark/images/m/button2.JPG|{{https://s3.amazonaws.com/digispark/images/t/button2.JPG}}]] Insert button on top and solder four leads on the bottom. [[https://s3.amazonaws.com/digispark/images/m/button3.JPG|{{https://s3.amazonaws.com/digispark/images/t/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. [[https://s3.amazonaws.com/digispark/images/m/button4.JPG|{{https://s3.amazonaws.com/digispark/images/t/button4.JPG}}]] [[https://s3.amazonaws.com/digispark/images/m/button5.JPG|{{https://s3.amazonaws.com/digispark/images/t/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 }