<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hack a Day &#187; button</title>
	<atom:link href="http://hackaday.com/tag/button/feed/" rel="self" type="application/rss+xml" />
	<link>http://hackaday.com</link>
	<description>Fresh hacks every day</description>
	<lastBuildDate>Sun, 12 Feb 2012 06:24:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hackaday.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/5560f98f805877b0e332f191cb9e0af3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Hack a Day &#187; button</title>
		<link>http://hackaday.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hackaday.com/osd.xml" title="Hack a Day" />
	<atom:link rel='hub' href='http://hackaday.com/?pushpress=hub'/>
		<item>
		<title>Fix broken buttons on your ASUS computer monitors</title>
		<link>http://hackaday.com/2012/01/19/fix-broken-buttons-on-your-asus-computer-monitors/</link>
		<comments>http://hackaday.com/2012/01/19/fix-broken-buttons-on-your-asus-computer-monitors/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 18:01:11 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[repair hacks]]></category>
		<category><![CDATA[Asus]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[stuck]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[vw202]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=65727</guid>
		<description><![CDATA[One of the perks of writing for Hackaday is that we often find hacks that we&#8217;ve been meaning to do ourselves. Here&#8217;s one that will let us fix our borked ASUS computer monitor buttons. [Silviu] has the same monitor we do, an ASUS VW202, and had the same problem of stuck buttons. We already cracked [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=65727&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-65728" title="fixing-broken-monitor-buttons" src="http://hackadaycom.files.wordpress.com/2012/01/fixing-broken-monitor-buttons-e1326907279930.jpg" alt="" width="470" height="230" /></p>
<p>One of the perks of writing for Hackaday is that we often find hacks that we&#8217;ve been meaning to do ourselves. Here&#8217;s one that will let us fix our borked ASUS computer monitor buttons. [Silviu] has the same monitor we do, an ASUS VW202, and had the same problem of stuck buttons. We already cracked ours open and realized that the buttons are not easily replaced (you&#8217;ve got to source the right one). We just unstuck the offender and vowed not to press that button again, but [Silviu] actually figured out <a href="http://www.sgvulcan.com/fixing-a-self-pressing-button-on-an-asus-vw202sr-monitor/">how to disassemble and repair the PCB mount switches</a>.</p>
<p>As with most consumer electronics these days the worst part of the process is getting the monitor&#8217;s case apart. The plastic bezel has little spring tabs all around it that must be gently pried apart. Once the PCB which hosts the buttons was removed, he took the metal housing off of the broken switch. Inside he found that a bit of metal particulate (leftovers from manufacturing?) were causing the problem. A quick cleaning with a cotton swab removed the debris and got the tactile switch working again.</p>
<br />Filed under: <a href='http://hackaday.com/category/repair-hacks/'>repair hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/65727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/65727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/65727/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=65727&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2012/01/19/fix-broken-buttons-on-your-asus-computer-monitors/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2012/01/fixing-broken-monitor-buttons-e1326907279930.jpg" medium="image">
			<media:title type="html">fixing-broken-monitor-buttons</media:title>
		</media:content>
	</item>
		<item>
		<title>Repair stuck iPod Nano buttons</title>
		<link>http://hackaday.com/2011/02/23/repair-stuck-ipod-nano-buttons/</link>
		<comments>http://hackaday.com/2011/02/23/repair-stuck-ipod-nano-buttons/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 22:03:53 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[ipod hacks]]></category>
		<category><![CDATA[repair hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[shim]]></category>
		<category><![CDATA[tape]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=35769</guid>
		<description><![CDATA[A system is only as strong as its weakest link and [Roberto Barrios] found that on the sixth generation iPod nano the buttons are the problem. It makes sense that the buttons would be exposed to wear since they&#8217;re movable parts. The issue isn&#8217;t one of contacts or springs wearing out, but how the buttons [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=35769&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-35770" title="ipod-nano-buttons" src="http://hackadaycom.files.wordpress.com/2011/02/ipod-nano-buttons-e1298485297912.jpg" alt="" width="470" height="353" /></p>
<p>A system is only as strong as its weakest link and [Roberto Barrios] found that on the sixth generation <a href="http://www.rbarrios.com/projects/NANO6BUTTON/">iPod nano the buttons are the problem</a>. It makes sense that the buttons would be exposed to wear since they&#8217;re movable parts. The issue isn&#8217;t one of contacts or springs wearing out, but how the buttons are assembled. Each consist of a couple of parts; the tactile piece that you see and press, the electrical switch which converts that force into an electrical signal, and a shim that bridges the gap between the two.</p>
<p>After two months of use the iPod [Roberto] was fixing had stopped responding to presses of the Power button. It turns out that the shims are attached with double-sided tape. Inspection of the internals revealed that the shim had slid to one side and no longer made contact with the electrical system. His solution was to remove the tape and clean off the goo, then reattach the shims using &#8220;two-part metal cement&#8221;.</p>
<p>With the shim back in place all is well but he made sure to execute this fix on all of the buttons before reassembly.</p>
<br />Filed under: <a href='http://hackaday.com/category/ipod-hacks/'>ipod hacks</a>, <a href='http://hackaday.com/category/repair-hacks/'>repair hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/35769/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/35769/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/35769/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=35769&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2011/02/23/repair-stuck-ipod-nano-buttons/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2011/02/ipod-nano-buttons-e1298485297912.jpg" medium="image">
			<media:title type="html">ipod-nano-buttons</media:title>
		</media:content>
	</item>
		<item>
		<title>This hack really pushes our buttons</title>
		<link>http://hackaday.com/2010/12/21/this-hack-really-pushes-our-buttons/</link>
		<comments>http://hackaday.com/2010/12/21/this-hack-really-pushes-our-buttons/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 18:10:38 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[clock hacks]]></category>
		<category><![CDATA[alarm clock]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[rube goldberg]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=31905</guid>
		<description><![CDATA[Yep, if you&#8217;ve got a button that needs pushing, this is one way to do it. [Travis] combined an old alarm clock with a car door-lock actuator and minimal logic circuitry to make this happen. When the alarm time is reached, the adjustable actuator comes down to press whichever button has been placed under it. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=31905&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-31906" title="button-pusher" src="http://hackadaycom.files.wordpress.com/2010/12/button-pusher-e1292873200273.jpg" alt="" width="470" height="392" /></p>
<p>Yep, if you&#8217;ve got a button that needs pushing, <a href="http://www.instructables.com/id/The-Automatic-Button-Pusher/">this is one way to do it</a>. [Travis] combined an old alarm clock with a car door-lock actuator and minimal logic circuitry to make this happen. When the alarm time is reached, the adjustable actuator comes down to press whichever button has been placed under it. In the video after the break he&#8217;s using it to schedule the start time for his Roomba, make his coffee, heat his pizza, or pointlessly press the clock&#8217;s own snooze button (classic). We think this is just begging to be used with a Rube-goldberg setup, perhaps to topple to <a href="http://hackaday.com/2010/01/11/lego-robot-lays-dominoes-not-eggs/">d</a><a href="http://hackaday.com/2010/01/11/lego-robot-lays-dominoes-not-eggs/">ominos that other robot took the time to set up</a>. Oh wait&#8230; that shows up in the video too. Fantastic!</p>
<p><span id="more-31905"></span><span style="text-align:center; display: block;"><a href="http://hackaday.com/2010/12/21/this-hack-really-pushes-our-buttons/"><img src="http://img.youtube.com/vi/emaWr7aDaEE/2.jpg" alt="" /></a></span></p>
<br />Filed under: <a href='http://hackaday.com/category/clock-hacks/'>clock hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/31905/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/31905/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/31905/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=31905&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/12/21/this-hack-really-pushes-our-buttons/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/12/button-pusher-e1292873200273.jpg" medium="image">
			<media:title type="html">button-pusher</media:title>
		</media:content>
	</item>
		<item>
		<title>Debounce Code &#8211; one post to rule them all</title>
		<link>http://hackaday.com/2010/11/09/debounce-code-one-post-to-rule-them-all/</link>
		<comments>http://hackaday.com/2010/11/09/debounce-code-one-post-to-rule-them-all/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 19:29:34 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[debounce]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29916</guid>
		<description><![CDATA[Last month we asked you to send in your debounce code. You didn&#8217;t disappoint and it&#8217;s time to share the code received. There were some guideline for sending in code so if you don&#8217;t see yours here, it probably didn&#8217;t follow the rules, sorry. We also tried to weed out code that using delay loops [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29916&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29272" title="debounce-waveform" src="http://hackadaycom.files.wordpress.com/2010/10/debounce-waveform.jpg" alt="" width="470" height="244" /></p>
<p>Last month <a href="http://hackaday.com/2010/10/13/open-call-send-us-your-debounce-code/">we asked you to send in your debounce code</a>. You didn&#8217;t disappoint and it&#8217;s time to share the code received. There were some guideline for sending in code so if you don&#8217;t see yours here, it probably didn&#8217;t follow the rules, sorry. We also tried to weed out code that using delay loops for debounce. These tend to be a poor way to handle inputs because they monopolize the processor.</p>
<p>We wanted to add upvote/downvote buttons to each set of code to give some idea of a group consensus on code quality but there&#8217;s no good system available for multiple up/down vote widgets on one wordpress page. This results in a huge code dump for any one person to go through. If you&#8217;ve got any ideas on how to better organize this let us know: <a href="mailto:debounce@hackaday.com">debounce@hackaday.com</a>.</p>
<p>We make no guarantees that this code is safe to use, or that it even works. Test it carefully before using for important tasks.</p>
<p>Join us after the break for a whirlwind of code examples.</p>
<h2><span id="more-29916"></span>Ned&#8217;s Debounce Code</h2>
<p>Ned sent in a package of debounce code that monitors multiple buttons, debounces them, and detects button hold and release.</p>
<p>Main.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/*****************************************************************************************
 * Project:			Button Code
 * Version:			V1.0
 * Client:			ProTechNZ
 * Date Created:	22/07/2010
 * Date Modified:	23/07/2010
 * Author:			Neil van Geffen
 * Company:			ProTech NZ

 * Micro:			ATMega128
 * Speed:			8MHz
 * Clock Source:	Internal
 *****************************************************************************************/

/************************* Defines *******************************************************/
#include &lt;io.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;delay.h&gt;
#include &quot;NedsStandardHeader.h&quot;
#include &quot;C Files\buttons.h&quot;

#define BTN_UP			0x01
#define BTN_DOWN		0x02
#define BTN_ENTER		0x04
#define BTN_CLEAR		0x08

/************************* Structs and Enums *********************************************/

/************************* Function Prototypes *******************************************/
unsigned char TimeYet(unsigned int time);
unsigned int TimeDiff(unsigned int past, unsigned int future);
void USART0SendByte(unsigned char byteToSend);
void USART1SendByte(unsigned char byteToSend);
void USART0SendArray(unsigned char *array, unsigned char noOfBytes);
void USART0SendString(unsigned char *string);
void USART0SendStringF(flash unsigned char *string);

/************************* Global Variables***********************************************/
unsigned char tempByte;
unsigned int tempWord;

unsigned char pA, pB, pC, pD;

unsigned char releaseCounter;

volatile unsigned int isrTime;
unsigned int currentTime;
unsigned int timeButtons;
unsigned int clearPressed;

/************************* Setup Code ****************************************************/
void SetupPorts (void) {
    PORTA = 0x00;
    PORTB = 0x00;
    PORTC = 0x00;
    PORTD = 0x04;    // RXD1 (2)
    PORTE = 0x01;    // RXD0 (0)
    PORTF = 0x00;

    DDRA = 0xF0;
    DDRB = 0xFF;
    DDRC = 0xFF;
    DDRD = 0xFF;    // TXD1 (3)
    DDRE = 0x02;    // TXD0 (1)
    DDRF = 0xFF;
}

// 1mS timer
void SetupTimers (void) {
	TCCR0 = (0 &lt;&lt; FOC0) | (0 &lt;&lt; WGM00) | (0 &lt;&lt; COM01) | (0 &lt;&lt; COM00) | (1 &lt;&lt; WGM01) | (1 &lt;&lt; CS02) | (0 &lt;&lt; CS01) | (0 &lt;&lt; CS00);	// CTC 8e6/64/125 = 1KHz
	OCR0 = 124;
	TIMSK |= (1 &lt;&lt; OCIE0);
}

/************************* Main Code *****************************************************/
void main(void) {
	SetupPorts();
	SetupTimers();

	SREG.7 = 1;

	while (1)
	{
		SREG.7 = 0;											// Atomic Time Keeping
		currentTime = isrTime;
		SREG.7 = 1;

		pC &amp;= 0x07;											// keep pC to a max of 7
		pD &amp;= 0x07;											// keep pD to a max of 7
		PORTB = btnStatus.lastCount;						// output number of buttons pressed to LEDs on PortB
		PORTC = (0x80 &gt;&gt; pC);								// output a counter to PortC
		PORTD = (0x80 &gt;&gt; pD);								// output a counter to PortD

		if (TimeYet(timeButtons)) {							// Time to run this bit of code yet
			timeButtons += 5;								// Set the next time to 5mS away (can be any value really)

			UpdateButtons(currentTime);                     // Update the buttons
		}

		if (buttons.held) {									// If any button is held
			PORTF &amp;= 0x0F;									// clear the high nibble off PortF
			PORTF |= (buttons.held &lt;&lt; 4);					// and output the buttons held to PortF high nibble
			clearPressed = currentTime + 20;				// set the clearPressed time to 20ms (used to clear the LEDs after 20ms)

			switch (buttons.held) {							// do something depending on what buttons are held (can do a &quot;case BTN_UP | BTN_DOWN:&quot; if you wanted to as well)
				case BTN_UP:	pD++;		break;
				case BTN_DOWN:	pD--;		break;
				case BTN_ENTER:	pC++;		break;
				case BTN_CLEAR:	pC--;		break;
				default: pB++;
			}

			buttons.held = 0;								// Clear the buttons held flags
		}

		if (buttons.pressed) {								// if a button is pressed
			PORTF &amp;= 0xF0;									// clear the low nibble
			PORTF |= buttons.pressed;						// and set the current puttons held to the low nibble
			clearPressed = currentTime + 200;				// set the clearPressed time to 200ms to get it to clear the LEDs after 200ms

			switch (buttons.pressed) {						// do something depending on what buttons are pressed
				case BTN_UP:	pD++;		break;
				case BTN_DOWN:	pD--;		break;
				case BTN_ENTER:	pC++;		break;
				case BTN_CLEAR:	pC--;		break;
				default: pB++;
			}

			buttons.pressed = 0;							// clear the buttons pressed flags
		}

		if (buttons.released) {								// if any buttons are released
			releaseCounter++;								// increment the release counter
			PORTF = 0x00;									// clear PortF LEDs
			PORTA &amp;= 0x0F;									// clear the PortA high nibble
			PORTA |= (releaseCounter &lt;&lt; 4);					// and set what buttons were released to tht PortA LEDs

			switch (buttons.released) {						// do something on a button release
				case BTN_UP:	pD = 0;		break;
				case BTN_DOWN:	pD = 7;		break;
				case BTN_ENTER:	pC = 0;		break;
				case BTN_CLEAR:	pC = 7;		break;
				default: pB++;
			}

			buttons.released = 0;							// clear the button released flags
		}

		if (TimeYet(clearPressed)) {						// if we should clear the LEDs
			clearPressed = currentTime;						// stop the time from wrapping-over
			PORTF = 0x00;									// clear the LEDs
		}
	}
}

/************************* Functions *****************************************************/
unsigned char TimeYet(unsigned int time) {
 	if (((time - 1) - currentTime) &gt; 0xF000) {				// if the time has passed (will roll around when not serviced for 4095 counts)
    	return 1;											// the time has passed
    }
	else return 0;											// or else it has not yet passed
}

/************************* Interrupts ****************************************************/
interrupt [TIM0_COMP] void TimerZeroCompare (void) {
	isrTime++;												// Keep Time
}</pre></p>
<p>Buttons.h:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/************************************* START OF LIBRARY COMMENTS *******************************
* Library Name:		Neds Button Code
* Version:			V1.0
* Created:      	22/07/10
* Last Mod:			23/07/10
* CV Version:		2.04.8a
* Author:       	Neil van Geffen
* Company:      	ProTechNZ
* Purpose:      	Read 4 buttons and return button presses, helds and releases.
************************************************************************************************/

/************************************* KNOWN BUGS **********************************************
*
************************************************************************************************/

/************************************* NOTES ***************************************************
* The code will decode the button presses into presses, holds and releases.
* A press is a press AND release before a hold is registered
* A hold is a press held long enough to register as a hold.
* A hold will automatically repeat itself at an increasing rate
************************************************************************************************/

#define BUTTONS			(PINA &amp; 0x0F)		// Make the buttons the lower nibble active high (use ~ to get active low buttons to appear as active high)

#define REPEAT_MAX		250					// The start value of repeat debouncing when first pressing a button
#define REPEAT_MIN		25					// The lowest value of repeat debouncing when first holding a button
#define SPEED_SHIFT		3					// The repeat value decreases by the current repeat value &gt;&gt; by this value (aka 4 means it decreases by 1/16th every time)
#define DEBOUNCE_PRESS	25					// The debounce for a single press
#define DEBOUNCE_HOLD	600					// The debounce for a button hold

struct {
	unsigned int pressed:4;			// holds which buttons have been pressed and released
	unsigned int held:4;			// holds which buttons have been held for more than DEBOUNCE_HOLD
	unsigned int released:4;		// holds which buttons have been released after a button was held
} buttons;

#pragma used+
/***** UpdateButtons
 * Read 4 buttons (defined as BUTTONS above)
 * and save them to the buttons struct.
 * Best if called on a regulat basis like every 10mS.
 * Calling more often will give better resolution on button presses.
 ----------
 * @param - curretTime, the current time to compare the last press too to calculate debounce and press held length
 *****/
void UpdateButtons(unsigned int currentTime);
#pragma used-

#include &quot;buttons.c&quot;</pre></p>
<p>Buttons.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/************************************* START OF LIBRARY COMMENTS *******************************
* Library Name:		Neds Button Code
* Version:			V1.0
* Created:      	22/07/10
* Last Mod:			23/07/10
* CV Version:		2.04.8a
* Author:       	Neil van Geffen
* Company:      	ProTechNZ
* Purpose:      	Read 4 buttons and return button presses, helds and releases.
************************************************************************************************/

/************************************* KNOWN BUGS **********************************************
*
************************************************************************************************/

/************************************* NOTES ***************************************************
*
************************************************************************************************/

#define BUTTON_COUNT	((BUTTONS &amp;&amp; (BUTTONS &amp; (1 &lt;&lt; 0))) + (BUTTONS &amp;&amp; (BUTTONS &amp; (1 &lt;&lt; 1))) + (BUTTONS &amp;&amp; (BUTTONS &amp; (1 &lt;&lt; 2))) + (BUTTONS &amp;&amp; (BUTTONS &amp; (1 &lt;&lt; 3))))

#warning By compiling Neds button code, you acknowledge he is the man!

struct {
	unsigned char heldFlag:1;		// used by neds code, never change
	unsigned char decreaseFlag:1;	// used by neds code, never change

	unsigned char lastStatus:4;		// used by neds code, never change. The last valid combination of buttons pressed
	unsigned char lastCount:4;		// used by neds code, never change. The number of buttons held at one time

	unsigned int time;				// used by neds code, never change. The time the button press was changed

	unsigned int repeat;			// used by neds code, never change. The time between button held repeats
} btnStatus;

unsigned int TimeDiff(unsigned int past, unsigned int future) {
	if (((future - 1) - past) &gt; 0xF000) return 0;
	else return future - past;
}

void UpdateButtons(unsigned int currentTime) {
	if (TimeDiff(btnStatus.time, currentTime) &gt;= DEBOUNCE_HOLD) {									// If a button has been held
		if (btnStatus.decreaseFlag) {																// if the button count was lowered earlier but they have remained the same for the length of a hold time
			btnStatus.decreaseFlag = FALSE;														// clear the flag that states it was lowered
			btnStatus.lastStatus = BUTTONS;														// and set the button status to the currently pressed buttons
		}

		buttons.held = btnStatus.lastStatus;																// Set what buttons were held
		btnStatus.time += btnStatus.repeat;																// and set the time to repeat the next press
		btnStatus.repeat = MAX(REPEAT_MIN, btnStatus.repeat - MAX(1,(btnStatus.repeat &gt;&gt; SPEED_SHIFT)));		// and lower the repeat value to increase the button held repeat rate
		btnStatus.heldFlag = TRUE;																			// and set the flag that states a button was held
	}

	if (!BUTTONS) {
		if (btnStatus.heldFlag) {																	// If the buttons were previously held
			btnStatus.heldFlag = FALSE;															// Clear the flag so it doesnt set buttons pressed continously
			buttons.released = btnStatus.lastStatus;												// Set what buttons were pressed previously
		}
		else if (TimeDiff(btnStatus.time, currentTime) &gt;= DEBOUNCE_PRESS) {						// but if the buttons werent held, but pressed for long enough to pass as a debounce
			buttons.pressed = btnStatus.lastStatus;												// Set what buttons were pressed
		}

		btnStatus.lastCount = 0;																	// Clear the last count
		btnStatus.lastStatus = 0;																	// Clear the last Status
		btnStatus.time = currentTime;																// clear the last press time
	}
	else if (BUTTON_COUNT &gt; btnStatus.lastCount) {												// if the number of buttons pressed has changed
		btnStatus.lastCount = BUTTON_COUNT;														// save it for next time.
		btnStatus.lastStatus = BUTTONS;															// and save what buttons were pressed.
		btnStatus.decreaseFlag = FALSE;															// clear the flag that says the button presses just decreased.

		btnStatus.time = currentTime;																// reset the time of last button presses.
		btnStatus.repeat = REPEAT_MAX;															// and reset the time between held repeats.

	}
	else if (BUTTON_COUNT &amp;&amp; (BUTTON_COUNT &lt; btnStatus.lastCount)) {								// Or if the button count deceased but a button is still pressed
		btnStatus.lastCount = BUTTON_COUNT;														// save the count for next time
		btnStatus.decreaseFlag = TRUE;															// set the flag to say this happened

		btnStatus.time = currentTime;																// reset the time of last button presses.
		btnStatus.repeat = REPEAT_MAX;															// and reset the time between held repeats.
	}
	else if (!btnStatus.decreaseFlag &amp;&amp; (BUTTONS != btnStatus.lastStatus)) {						// If someone changed button presses but not the count
		btnStatus.lastCount = 0;																	// Force the count to change next time around so the code to set times etc isnt in 2 places.
	}                                                                   						// This is a fairly useless bit of code if the service time is less than 10mS and even if its more, it won't be all that usefull.
}</pre></p>
<h2>S1axter&#8217;s Debounce Code</h2>
<p>Developed for PIC24 chips, this code repeatedly calls a function to check a pin state.</p>
<p>pin_io.h:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pin I/O control module - Header
//
// Language: Microchip C30
//
// File:     pin_io.h
// Author:   MyBitBox.com/Geeksinside.com
// Created:  08/23/09
//
//////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __PIN_IO_H__
#define __PIN_IO_H__

void pin_io_init(void);
void pin_input_check(void);

#endif

</pre></p>
<p>pin_io.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Pin I/O control module
//
// Language: Microchip C30
//
// File:     pin_io.c
// Author:   MyBitBox.com/Geeksinside.com
// Created:  08/23/09
//
//////////////////////////////////////////////////////////////////////////////////////////////////////

typedef struct{
	uint16 mask;
	uint16 last_state;
	uint8 changed;
}pin_check_struct;

pin_check_struct inputA, inputB;

//====================================================================================
// Set up the pins
//====================================================================================
void pin_io_init(void)
{

	inputA.changed = FALSE;
	inputA.last_state = FALSE;
	inputA.mask = BMASK(2);       // look at PORTB2

	inputB.changed = FALSE;
	inputB.last_state = FALSE;
	inputB.mask = BMASK(4);        // look at PORTB4

	return;
}

//====================================================================================
// This is the debounce routine. When this is called it checks for consistant pin states
//====================================================================================
void pin_input_check(void)
{

	uint16 portb_snapshot = PORTB;

	// This is for the XXXXX input
	// ------------------------------------------------------
	if(inputA.changed == TRUE)
	{

		if(!((portb_snapshot ^ inputA.last_state)&amp;inputA.mask))
		{
			// If the line was changed last time, and it is the same state as last
			// time, then we need to lock it in here (If the bits are not the same then this routine
			// will be called again and the correct value will be locked in)
			if(portb_snapshot &amp; inputA.mask)
			{
				// Do this when the line goes high
				SYS_STATUS.FLAG_XXXXX_LINE = TRUE;
			}else{
				// Do this when the line goes low
				SYS_STATUS.FLAG_XXXXX_LINE = FALSE;
			}
			// Clear the changed flag
			inputA.changed = FALSE;
		}
	}
	// Mask out any changed input pins
	inputA.changed = ((inputA.last_state ^ (portb_snapshot &amp; inputA.mask))&gt;0);		// XOR with last last_state to find changed pins
	inputA.last_state = portb_snapshot &amp; inputA.mask;

	// This is for the YYYYY input
	// ------------------------------------------------------
	if(inputB.changed == TRUE)
	{

		if(!((portb_snapshot ^ inputB.last_state)&amp;inputB.mask))
		{
			// If the line was changed last time, and it is the same state as last
			// time, then we need to lock it in here (If the bits are not the same then this routine
			// will be called again and the correct value will be locked in)
			if(portb_snapshot &amp; inputB.mask)
			{
				// Do this when the line goes high
				SYS_STATUS.FLAG_YYYYY_LINE = TRUE;
			}else{
				// Do this when the line goes low
				SYS_STATUS.FLAG_YYYYY_LINE = FALSE;
			}
			// Clear the changed flag
			inputB.changed = FALSE;
		}
	}
	// Mask out any changed input pins
	inputB.changed = ((inputB.last_state ^ (portb_snapshot &amp; inputB.mask))&gt;0);		// XOR with last last_state to find changed pins
	inputB.last_state = portb_snapshot &amp; inputB.mask;

	return;
}

//end</pre></p>
<h2>Aaron Keith&#8217;s Debounce Code</h2>
<p>This code is tailored for an 8051 processor.</p>
<p>Button_debounce_8051.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/*--------------------------------------------------------------------------
10/14/2010: Button debounce code by Aaron Keith

This code detects and debounces button presses. It is tailored for use with
8051 micro controllers.  Complied on the RIDE 51 Complier

The interrupt service routine (ISR) runs 3600 times per second.  If the
button is pressed (the pin is connected to GND) Key_Hit is incremented to the
maximum 255.  When the button is released Key_Hit will decremented to 0.
Long_Key_Hit will increment more slowly and is used to detect the button
being help down.
--------------------------------------------------------------------------*/

#include&lt;reg51.h&gt;

#define TRUE 1
#define FALSE 0

//define pins used by buttons
at 0x97 sbit P1_7 ;
#define BUTTON P1_7   //Button on Port 1.7

//De bounce variables
unsigned char Key_Hit;
unsigned char Long_Key_Hit;

/*--------------------------------------------------------------------------
  Prototypes
--------------------------------------------------------------------------*/
void init_timers(void);

/*--------------------------------------------------------------------------
  FUNC: - Sets and starts a system timer
  PARAMS: NONE
  RETURNS: NONE
--------------------------------------------------------------------------*/
void init_timers(void)          // using a 11.0592 Mhz Clock
{
  TMOD = 0x02; //T0 mode 2 8 bit reload
  // Timer 0 is system tick

  TH0 = 0x00; // Reload = 256, giving 921600/256=3600
  TL0 = 0x00;

  ET0 = TRUE; // Enable interrupt on timer 0
  TR0 = TRUE; // Start timer 0;

  EA = TRUE;
}

/*--------------------------------------------------------------------------
  FUNC:  - Main
--------------------------------------------------------------------------*/
void main(void)
{

  init_timers(); //start the timer

  for (;;) //loop forever
    {

      if (Key_Hit == 0xff)
        {
          //Key press detected. Do something here
        }

      if (Key_Hit == 0x00)
        {
          //Key release detected. Do something here
        }

      if (Long_Key_Hit == 0xff)
        {
          //Key press and help down. Do something here
        }

    }

}

/*--------------------------------------------------------------------------
  INTERRUPT:  // The procedure runs 3600 times per second
--------------------------------------------------------------------------*/
void Timer0_interrupt(void) interrupt 1
{

  static unsigned char Div18Counter = 0;

  if (BUTTON)
    { // Button up (Pin is connected to VCC)
      if (Key_Hit != 0)  // Will never go below zero
        {
        Key_Hit--;
        }
    }
  else
    { // Button down (Pin is connected to GND)
      if (Key_Hit != 0xff)  // Will never go above 255
        {
        Key_Hit++;
        }
    }

  if (++Div18Counter &gt;= 18)   // run ever 5 mSec
    {
      Div18Counter = 0;

      if (Key_Hit == 0xff)
        {
          if (Long_Key_Hit != 0xff)
            Long_Key_Hit++;
        }
      else if (Key_Hit == 0x00)    // No delay when detecting key release.
        Long_Key_Hit = 0x00;
    }

}</pre></p>
<h2>Thomas Flayols&#8217; Debounce Code</h2>
<p>This code creates a software-based low-pass filter by taking a moving average of the pin value.</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">// Hi, to prevent contact bounce, my solution is to create software low pass filter by using a moving average...(no delay solution) see the jpg to see what's happen
// INPUT is the button input pin(0if not pressed, 1 if pressed)

main(void)
{
    unsigned char button = 0;
    while(1)
    {
         // your code here...

         button=(button * 9+INPUT * 10)/10; // do a moving average of the digital input... result button between 0 and 10

         if (button &gt; 5)
         {
                //the button is ON
         }
         else
         {
                //the button is OFF
         }

    }
}</pre></p>
<h2>Ganesh Krishna&#8217;s Debounce Code</h2>
<p>Can be scaled to any number of buttons, sample rate is configurable, and this aims to use as little RAM as possible</p>
<p>dbounce.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">#include &lt;htc.h&gt;

/* Scalable software debounce for buttons
 *
 * This is quick implementation of software debounce with as little RAM as possible.
 * stress is given to scalability of number of buttons
 * and scalability of number of samples per debounce cycle.
 *
 * While this file is written for PIC Microcontroller and Hi-tech compiler,
 * the debounce function itself is just C, and not hardware dependant.
 *
 * Use the functions at your own risk
 * Author: ganesh.ksm@gmail.com
 *
 * Assume BSD like license.
 * Acknowledge with an email if it works for you.
 *
*/

/*Number of buttons in the system*/
#define MAX_BUTTONS 4

/* MAJORITY_VOTE Number of samples for which the button must remain in pressed state
 * to consider that the button is pressed.
 * */
#define MAJORITY_VOTE 5

/* STABILITY_BITS is the number of final samples (last few samples at the end of debounce)
 * after which we consider the input stable
 * */
#define STABILITY_BITS 2

/* Convert Stability bits to a bit mask, i.e STABILITY_MASK has STABILITY_BITS bits set in its LSB
 * */
#define STABILITY_MASK ((1&lt;&lt;STABILITY_BITS) - 1)

/*This variable contains the debounced status of all buttons
   at any point of time
   */
volatile unsigned int debounced_buttons;

/* Reads port pins and returns 1 if button is active (assumed active low)
 * returns 0 if inactive. Microchip PIC18 specific.
 * */
unsigned char Read_Portbit(int button)
{
	switch(button)
	{
		case 0: return !RA0;
		case 1: return !RA1;
		case 2: return !RA2;
		case 3: return !RA3;
	}
}

/* Function: button_is_pressed()
 * Argument: Takes the button number as argument, an index into the array of buttons.
 * Returns:  non zero if the button of interest is pressed for majority time of polling
 *           returns zero if not pressed, debouncing not complete,
 *           button bouced back to unpressed state
 *
 * Calling rate: This function will return positive only after MAJORITY_VOTE is achieved
 *  times with same button argument for debounce of one button.
 * 		 where X is the number of samples per debounce,
 *
 * Depends on: Read_Portbit(button) which returns 1 if the pin of button of interest is active and 0 if not.
 */
char button_is_pressed( unsigned char button)
{
	unsigned int bit_count=0, temp;

	/* button_bits[] is an array to hold the previous states of the port pin value
	 * Each element holds the previous samples of teh button read.
	 * We need as many elements as there are buttons.
	 * Make this an integer array if more than 8 samples are needed for debounce determination.
	 * if less samples are needed adjust the MAJORITY_VOTE and STABILITY_BITS to a smaller number
	 * */

volatile static unsigned char button_bits[MAX_BUTTONS];

	/* Shift the latest read button status into the que
	 * we should have the latest sample in LSB and older samples
	 * higher up.*/

	button_bits[button]=button_bits[button]&lt;&lt;1 | (Read_Portbit(button) &amp; 0x01);
	temp = button_bits[button];

	/*Check if the input is stable in the last STABILITY_BITS samples*/
	if ((temp &amp; STABILITY_MASK) == STABILITY_MASK)
	{
		/* Count the number of bits set in temp, we need more than the majority
		 * straight out of the book of K&amp;R, check it :-)*/
		while(temp = temp&amp;(temp-1))
			bit_count++;
		bit_count++; // we are off by one

		/*Check if the required number of samples were favourable */
		if (bit_count&gt;=MAJORITY_VOTE)
		{
			button_bits[button] = 0;
			return 1;
		}
		else
			return 0;
	}
	else
	{
		return 0;
	}
}

/* Call at a rate about 8 times higher than the rate at which input detection is required
 * actual frequency depends on the number of samples required per debounce.
  */

void Service_user_Input(void)
{
	int i;
	for (i=0;i&lt;MAX_BUTTONS;i++)
	{
		if (button_is_pressed(i))
			debounced_buttons = debounced_buttons | 0x01&lt;&lt;i;
	}
}

void main (void)
{
	/*PIC18 specific intialization of timer interrupt*/
	GIE=1;
	PEIE=1;
	TMR0IE=1;

	T0CON= 0X48;    //16 bit timer without Prescaler for interrupts
	TMR0L=0xFA;
	TMR0H=0xFF;
	TMR0ON=1;
	TRISA = 0xFF; // PORTA is input.
	/*Application code starts here*/
	while(1)
	{
		/*Do something usefull with debounced_buttons*/
	}

}

void interrupt User_Input()
{
	TMR0L=0x00; /*Not really needed, but lets be explicit*/
	TMR0H=0x00;
	TMR0ON=1;

	Service_user_Input(); /*you may choose to call this in an timed function in the main thread too*/
}</pre></p>
<h2>Kenneth Kuhn&#8217;s Debounce Code</h2>
<p>[Chad] has been using a modified version of <a href="http://www.kennethkuhn.com/electronics/debounce.c">[Kenneth Kuhn's] debounce code</a> for some time now. Small, fast, and well commented, it uses an integrator algorithm.</p>
<p>debounce.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/******************************************************************************

debounce.c
written by Kenneth A. Kuhn
version 1.00

This is an algorithm that debounces or removes random or spurious
transistions of a digital signal read as an input by a computer.  This is
particularly applicable when the input is from a mechanical contact.  An

integrator is used to perform a time hysterisis so that the signal must
persistantly be in a logical state (0 or 1) in order for the output to change
to that state.  Random transitions of the input will not affect the output

except in the rare case where statistical clustering is longer than the
specified integration time.

The following example illustrates how this algorithm works.  The sequence
labeled, real signal, represents the real intended signal with no noise.  The

sequence labeled, corrupted, has significant random transitions added to the
real signal.  The sequence labled, integrator, represents the algorithm
integrator which is constrained to be between 0 and 3.  The sequence labeled,

output, only makes a transition when the integrator reaches either 0 or 3.
Note that the output signal lags the input signal by the integration time but
is free of spurious transitions.

real signal 0000111111110000000111111100000000011111111110000000000111111100000

corrupted   0100111011011001000011011010001001011100101111000100010111011100010
integrator  0100123233233212100012123232101001012321212333210100010123233321010
output      0000001111111111100000001111100000000111111111110000000001111111000

I have been using this algorithm for years and I show it here as a code
fragment in C.  The algorithm has been around for many years but does not seem
to be widely known.  Once in a rare while it is published in a tech note.  It

is notable that the algorithm uses integration as opposed to edge logic
(differentiation).  It is the integration that makes this algorithm so robust
in the presence of noise.
******************************************************************************/

/* The following parameters tune the algorithm to fit the particular
application.  The example numbers are for a case where a computer samples a
mechanical contact 10 times a second and a half-second integration time is

used to remove bounce.  Note: DEBOUNCE_TIME is in seconds and SAMPLE_FREQUENCY
is in Hertz */

#define DEBOUNCE_TIME		0.3
#define SAMPLE_FREQUENCY	10
#define MAXIMUM			(DEBOUNCE_TIME * SAMPLE_FREQUENCY)

/* These are the variables used */
unsigned int input;       /* 0 or 1 depending on the input signal */
unsigned int integrator;  /* Will range from 0 to the specified MAXIMUM */
unsigned int output;      /* Cleaned-up version of the input signal */

/* Step 1: Update the integrator based on the input signal.  Note that the
integrator follows the input, decreasing or increasing towards the limits as
determined by the input state (0 or 1). */

  if (input == 0)

    {
    if (integrator &gt; 0)
      integrator--;
    }
  else if (integrator &lt; MAXIMUM)
    integrator++;

/* Step 2: Update the output state based on the integrator.  Note that the
output will only change states if the integrator has reached a limit, either

0 or MAXIMUM. */

  if (integrator == 0)
    output = 0;
  else if (integrator &gt;= MAXIMUM)
    {
    output = 1;
    integrator = MAXIMUM;  /* defensive code if integrator got corrupted */
    }

/********************************************************* End of debounce.c */</pre></p>
<h2>Ubi de Feo&#8217;s Debounce Code</h2>
<p>Arduino sketch to debounce pins from an array.</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">#define ARRAY_SIZE 8
// array of pins to be debounced
short pinsToDebounce[]={
  2,3,4,5,6,7,8,9
};
// array of pin state
int swStates[]={
  0,0,0,0,0,0,0,0};
// array of previous pin state
int swPrevStates[]={
  0,0,0,0,0,0,0,0};
// array to store the actual state during debounce
int swDebouncedStates[]={
  0,0,0,0,0,0,0,0};
// array to store the previous state during debounce
int swPrevDebounceStates[]={0,0,0,0,0,0,0,0};
// time to debounce
int debounceDelay=100;
// array of previous times the pin has been checked
long prevTimes[]={
  0,0,0,0,0,0,0,0};

void setup(){
  Serial.begin(9600);

 initSwitches();
}
void loop(){
 readSwitches();
}

void initSwitches(){
  for(int i=0;i&lt;ARRAY_SIZE;i++){
    pinMode(pinsToDebounce[i],INPUT);
  }
}
void readSwitches(){

  // Serial.print(&quot;active switch set &quot;);
  // Serial.println((int)activeSwitchSet);

  for(short sw=0;sw&lt;ARRAY_SIZE;sw++){
    volatile int pin=pinsToDebounce[sw];
    volatile int mpPin=pin;
    volatile int pinPosition=sw;

    swStates[pinPosition]=digitalRead(pin);
  }

  debouncePins();
   checkStateChange();
}
void debouncePins(){

  volatile long _millis=millis();

  for(short sw=0;sw&lt;ARRAY_SIZE;sw++){
    if(swStates[sw]!=swPrevStates[sw]){
      prevTimes[sw]=_millis;
    }
    if(_millis-prevTimes[sw]&gt;debounceDelay){
      prevTimes[sw]=_millis;
      swDebouncedStates[sw]=swStates[sw];
      /*
      Serial.print(&quot;button &quot;);
       Serial.print(sw);
       Serial.print(&quot; is &quot;);
       Serial.println(swDebouncedStates[sw]);
       */
    }
    swPrevStates[sw]=swStates[sw];
  }

}

void checkStateChange(){
  for(short sw=0;sw&lt;5;sw++){
    if(swPrevDebounceStates[sw]!=swDebouncedStates[sw]){
      /*
      Serial.println(&quot;&quot;);
      Serial.print(&quot;button &quot;);
      Serial.print(sw);
      Serial.print(&quot; &quot;);
      Serial.println(swDebouncedStates[sw]);
      */
      if(swDebouncedStates[sw]==1){
        pinActive(sw);
      }
      if(swDebouncedStates[sw]==0){
        pinInactive(sw);
      }
    }
    swPrevDebounceStates[sw]=swDebouncedStates[sw];
  }
}

void printDebStates(){
  Serial.println(&quot;%%%%%%%%%%%%%%%%%%%%%%%%&quot;);
  for(int i=0;i&lt;ARRAY_SIZE;i++){
    Serial.print(swDebouncedStates[i]);
    Serial.print('*');

  }

  Serial.println(&quot;&quot;);
}
void pinActive(int _id){

  Serial.print(&quot;active pin &quot;);
  Serial.println(pinsToDebounce[_id]);
}
void pinInactive(int _id){
   Serial.print(&quot;inactive pin &quot;);
 Serial.println(pinsToDebounce[_id]);
}</pre></p>
<h2>Christoph Gommel&#8217;s Debounce Code</h2>
<p>Debouncing and scanning a keyboard matrix with an STM32 ARM processor.</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/*
  keyboard.c
  Used on an STM32F103 in a wireless remote control
  (C) 2010 Christoph Gommel &lt;chg@contronix.de&gt;
  Contronix GmbH, Nizzastr. 6, 01445 Radebeul, Germany
  Tags: matrix, keyboard, stm32, stm32f103, debounce, hackaday
 */
#include &quot;stm32f10x.h&quot;
#include &quot;keyboard.h&quot;
#include &quot;fifo.h&quot;

#define KEYBOARD_GPIO (GPIOA)

// Cols and rows are intentionally placed in the right order enabling the bit shifting trick used.

#define COL1 (GPIO_Pin_1)
#define COL2 (GPIO_Pin_2)
#define COL3 (GPIO_Pin_3)
#define COLS (COL1|COL2|COL3)

#define ROW1 (GPIO_Pin_4)
#define ROW2 (GPIO_Pin_5)
#define ROW3 (GPIO_Pin_6)
#define ROW4 (GPIO_Pin_7)
#define ROW5 (GPIO_Pin_8)
#define ROWS (ROW1|ROW2|ROW3|ROW4|ROW5)
//#define ROWS_B (ROW5)

#define ColNum (3)
#define RowNum (5)

#define ColStart (1)
#define RowStart (4)

//Very useful macro to increment and modulo in one instruction
#define incmod(n,m); n=((n+1)%m);

// Yes, we have a shift key too
#define SHIFT (GPIO_Pin_0)

GPIO_InitTypeDef GPIO_InitStructure;

#define KeyBufferSize (20)

//volatile unsigned char keypad_queue_buffer[KeyBufferSize];

static char keypad_queue_buffer[KeyBufferSize];
fifo_t keyfifo;

void keyboard_init(void)
{
  //Initialize a self made fifo system
  fifo_init(&amp;keyfifo, keypad_queue_buffer, KeyBufferSize);

  //Give clock to the GPIO
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

  //Initialize the rows as push-pull-output
  GPIO_InitStructure.GPIO_Pin = ROWS;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(KEYBOARD_GPIO, &amp;GPIO_InitStructure);

  //The cols ar input with pull-up
  GPIO_InitStructure.GPIO_Pin = COLS | SHIFT;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
  GPIO_Init(KEYBOARD_GPIO, &amp;GPIO_InitStructure);

  GPIO_SetBits(KEYBOARD_GPIO, ROWS);

}

volatile unsigned int CurrentRow = 0;
volatile unsigned int lastScan = 0;
volatile unsigned int thisScan = 0;
volatile unsigned int debounceCnt;
volatile unsigned int numberOfKeys;
volatile unsigned int thisScancode;
volatile unsigned int lastScancode;

//Adapt this to you wishes
#define debounceMax (10)

//The following piece of code will be called every 10 ms from a systick interrupt
void keyboard_scan(void)
{
  unsigned int scan;
  scan = ((~GPIO_ReadInputData(KEYBOARD_GPIO)) &amp; COLS) &gt;&gt; ColStart;

  //this is the really interesting core of my matrix scanning algorithm.
  //each key of the matrix is represented in one bit of a 16 bit unsigned short ;)
  thisScan = (thisScan | (scan &lt;&lt; (ColNum * RowNum))) &gt;&gt; ColNum;
  //Release Current Row
  GPIO_SetBits(KEYBOARD_GPIO, 1 &lt;&lt; (CurrentRow + RowStart));

  incmod(CurrentRow,RowNum);
  //prepare next Row

  GPIO_ResetBits(KEYBOARD_GPIO, 1 &lt;&lt; (CurrentRow + RowStart));

  if (0 == CurrentRow)
  {
    //Something changed, let's reset the debounce counter
    if (thisScan != lastScan)
    {
      debounceCnt = 0;
    }
    //...or increase if nothing changed
    else if (debounceCnt &lt; debounceMax)
    {
      debounceCnt++;
    }
    //... if the threshold is reached
    if (debounceCnt == debounceMax)
    {
      numberOfKeys = 0;
      int i;
      //count the number of keys pressed and mark the position of the set bit in &quot;thisScancode&quot;
      for (i = 0; i &lt; (ColNum * RowNum); i++)
        if (thisScan &amp; (1 &lt;&lt; i))
        {
          numberOfKeys++;
          thisScancode = i + 1;
        }
      //ignore multiple key presses...
      if (1 != numberOfKeys)
        thisScancode = 0;
      else
      {
       //.. except the shift key which is NOT part of the matrix
        if (keyboard_getshift())
          thisScancode |= KEYBOARD_SHIFT;
        if (thisScancode != lastScancode)
        {
          //printf(&quot;Scan: %d\r\n&quot;,thisScancode);
          fifo_put(&amp;keyfifo, thisScancode);
        //this is typematic. to generate multiple keystrokes on one single looooooooooong press
#ifdef ENABLE_TYPEMATIC
          typematicCnt=0;
#endif
        }
#ifdef ENABLE_TYPEMATIC
        else
        {
          typematicCnt++;
          if ((typematicThreshold+typematicSpeed)&lt;=typematicCnt)
          typematicCnt=typematicThreshold;

          if (typematicThreshold==typematicCnt)
          {
            fifo_put(&amp;keyfifo, thisScancode);
          }
        }
#endif
      }
      lastScancode = thisScancode;
      //Now we have to do the processing because we get some freshly debounced situation, baby!
      //currentKey=((thisScan^oldScan)&amp;thisScan);
      //oldScan=thisScan;
    }
    lastScan = thisScan;
    thisScan = 0;
  }
}

//that's it, folks ;)</pre></p>
<h2>Dean Hall&#8217;s Debounce Code</h2>
<p>Debouncing a pin interrupt on AVR microcontrollers</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/*
 * Sample debouncing code
 *
 * Copyright 2010 Dean Hall.
 * This code snippet is offered under the MIT license:
 * http://www.opensource.org/licenses/mit-license.html
 */

/*
 * The hardware is an AVR with a switch connected to the INT0 input.
 * The firmware uses:
 *
 * - AVR Libc: http://www.nongnu.org/avr-libc/
 * - The AvrX microkernel: http://www.barello.net/avrx/
 *
 * This sample code performs debouncing on the INT0 input.
 * Here is the expected sequence of actions:
 *
 * - The AVR can be doing anything (awake or asleep) when the button is pressed
 * - The button press produces a low-going signal and bounces for a time
 * - The low-going signal activates the INT0 interrupt
 * - The INT0 service routine:
 *     - Disables the INT0 interrupt so bouncing doesn't cause multiple IRQs
 *     - Puts an AvrX message in the event queue of the inputs task
 * - The event in the queue causes the inputs_task to be scheduled, which:
 *     - Performs the action that the INT0 button is supposed to invoke
 *     - Starts an AvrX delay timer to allow for the button to stop bouncing
 *       During this delay, other AvrX tasks may run.
 *     - After the delay, the INT0 interrupt is re-enabled for the next input.
 *
 * In this design, the delay is especially long (1s) due to a very cheap button
 * and no need to respond to fast button presses.
 *
 * The downside of this software design is that no other input events are
 * processed while a button is debounced, although their press-messages are
 * queued up and handled after the debounce period.  This behavior was
 * acceptable for this immediate design, but may not be for all situations.
 */

#include &lt;avr/interrupt.h&gt;
#include &quot;avrx.h&quot;

#define DEBOUNCE_DELAY (uint16_t)(1000 / MILLISECONDS_PER_TIC)

static MessageControlBlock remote_ctrl_pressed_msg;

/* Remote Control button press interrupt service routine */
AVRX_SIGINT(INT0_vect)
{
   IntProlog();

   /* Disable INT0/RemoteCtrl interrupt */
   GICR &amp;= ~_BV(INT0);

   AvrXIntSendMessage(&amp;inputs_msg_queue, &amp;remote_ctrl_pressed_msg);
   Epilog();
}

AVRX_GCC_TASKDEF(inputs_task, TASK_STACK_SIZE, 3)
{
   TimerControlBlock debounce_timer;
   MessageControlBlock *pmsg;

   /* Set INT0/RemoteCtrl and INT1/OpTest to trigger on falling edge */
   GICR &amp;= ~(_BV(INT0) | _BV(INT1));
   MCUCR &amp;= ~(_BV(ISC00) | _BV(ISC10));
   MCUCR |= (_BV(ISC01) | _BV(ISC11));
   GICR |= (_BV(INT0) | _BV(INT1));

   /* ... other initialization stuff removed */

   for (;;)
   {
       /* Wait for a message that an input was pressed or timer expired */
       pmsg = AvrXWaitMessage(&amp;inputs_msg_queue);

       /* ... removed if-cases for other unrelated input messages */

       else if (pmsg == &amp;remote_ctrl_pressed_msg)
       {
           DEBUG_PRINT(VERBOSITY_LOW, &quot;RmtCtrl pressed.\n&quot;);

           /* ... removed code that performs the action the button invokes */

           /* Debounce delay for RemoteCtrl button; lets other threads run */
           AvrXDelay(&amp;debounce_timer, DEBOUNCE_DELAY);

           /* Clear flag and enable interrupt */
           GIFR |= _BV(INTF0);
           GICR |= _BV(INT0);
       }
   }
}
</pre></p>
<h2>Brad Basler&#8217;s Debounce Code</h2>
<p>Debounce synchronously or asynchronously using an ISR. Usage is discussed in <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;index&amp;t=89686">this thread</a>.</p>
<p>debounce.h:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">#ifndef __DEBOUNCE_H__
#define __DEBOUNCE_H__

#include &lt;avr/interrupt.h&gt;

//Optimized for 20 millisecond period on a 1Mhz clock
#define DBNC_TIMR0_PRESCALER 	_BV(CS02)
#define DBNC_TIMR0_BASEVAL	 	178

//Defines the size of the debouncer handler arrays (i.e. 4 for a maximum of four)
#define DBNC_NUM_DEBOUNCERS		8

//Defines the number of timer ticks before a value is considered legitimate
//This will define a maximum debounce time of approx 100 milliseconds @ 5
//The minimum debounce time will be approx 80 milliseconds
#define DBNC_COUNTER_TOP 3

#define _BITSHIFTBY(bit,num) ((bit)&lt;&lt;(num))

typedef void(*debounceHandler)(uint8_t,uint8_t);

typedef struct
{
	//A pointer to a volatile port (I/O or otherwise)
	volatile uint8_t *port;

	//A pointer to a debounceHandler function
	debounceHandler handler;

	//This is the decremental counter which determines
	//if the button has been debounced
	uint8_t counter;

	/*

		Bits 0-3: bit index to check against (0-7)
		Bits 4-5: unused
		Bit    5: Last known sate
		Bit    6: Signaled
		Bit    7: Asynchronous

	*/
	uint8_t bitmap;
} DBNC_ITEM;

typedef struct
{

	//An array of debouncer units
	DBNC_ITEM dbUnits[DBNC_NUM_DEBOUNCERS];

	//This is set to 1 when any signal in the dbncSignaled array has been set
	uint8_t signalReady;

} DBNC_GLOBAL;

/*
	Forward Declarations
*/

//ISR for timer0 overflow interrupt
ISR(TIMER0_OVF_vect);
void callSignaledHandlers(void);
void registerDebouncer(volatile uint8_t *port,uint8_t bit,uint8_t index,uint8_t Asynchronous,debounceHandler handler);
void signalChangedState(uint8_t index,uint8_t counterTop);
void initializeDebouncerTimer();

#endif
</pre></p>
<p>debounce.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;
#include &lt;util/delay.h&gt;
#include &quot;debounce.h&quot;

volatile DBNC_GLOBAL db;

//ISR for timer0 overflow interrupt
ISR(TIMER0_OVF_vect)
{
	uint8_t i;
	uint8_t temp;
	uint8_t workDone = 0;

	//Cycle through all debounced items
	for (i=0;i&lt;DBNC_NUM_DEBOUNCERS;i++)
	{
		//Skip items that have been idle
		if (db.dbUnits[i].counter == 0)
			continue;

		workDone = 1;

		//If debounce period has elapsed
		if (--db.dbUnits[i].counter == 0)
		{

			//Grab current logical bit state of the port (1 or 0)
			temp = (((*(db.dbUnits[i].port)) &amp; _BV((db.dbUnits[i].bitmap &amp; 0b111))) != 0);

			//If current state != last state
			//store change
			if (temp != ((db.dbUnits[i].bitmap &amp; _BV(5)) &gt;&gt; 5))
			{
				//Flip last state bit
				db.dbUnits[i].bitmap ^= _BV(5);

				//If this debouncer item is synchronous
				//Then signal it
				if (!(db.dbUnits[i].bitmap &amp; _BV(7))) {

					//Signal this debouncer item
					db.dbUnits[i].bitmap |= _BV(6);

					//Signaling options
					db.signalReady = 1;
				}

				//Otherwise it's asynchronous,
				//call immediately
				else
					//Call Handler
					(*db.dbUnits[i].handler)(i,temp);
			}
		}
	}

	//If all counters were already 0, disable the timer
	if (!workDone)
		TCCR0B = 0;

	TCNT0  = DBNC_TIMR0_BASEVAL;
}

//Call any signaled handlers (to be executed in main program loop)
void callSignaledHandlers(void)
{
	int i;

	if (!db.signalReady) return;

	for (i=0;i&lt;DBNC_NUM_DEBOUNCERS;i++)
	{
		//Check if this item is signaled
		if (db.dbUnits[i].bitmap &amp; _BV(6)) {

			//If so, reset its signal
			db.dbUnits[i].bitmap &amp;= ~_BV(6);

			//Call item and pass on last known state
			(*db.dbUnits[i].handler)(i,(db.dbUnits[i].bitmap &amp; _BV(5))&gt;&gt;5);
		}
	}

	//Reset signal
	db.signalReady = 0;

}

void registerDebouncer(volatile uint8_t *port,uint8_t bit,uint8_t index,uint8_t Asynchronous,debounceHandler handler)
{
	//Store port pointer
	//Store handler pointer
	//Reset counter to 0
	//Store bitmap of bit offset/asynchronous state
	//Set signaled to 0
	db.dbUnits[index].port 		= port;
	db.dbUnits[index].handler 	= handler;
	db.dbUnits[index].counter  	= 0;

	db.dbUnits[index].bitmap	= _BITSHIFTBY((Asynchronous != 0),7)|
						 		  _BITSHIFTBY((((*port) &amp; _BV(bit)) != 0),5)|
						 		  bit;
}

void signalChangedState(uint8_t index,uint8_t counterTop)
{
	if (!counterTop)
		db.dbUnits[index].counter = DBNC_COUNTER_TOP;
	else
		db.dbUnits[index].counter = counterTop;

	if (!TCCR0B)
		TCCR0B = DBNC_TIMR0_PRESCALER;
}

void initializeDebouncerTimer()
{
	//Note: doesn't start timer
	TCCR0A = 0x00;
	TCCR0B = 0x00;
	TCNT0  = DBNC_TIMR0_BASEVAL;
	TIMSK0 = _BV(TOIE0);
}

</pre></p>
<p>test.c:</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;
#include &quot;debounce.h&quot;

volatile uint8_t lastState;

void ButtonClicker(uint8_t index,uint8_t state);

/*

Pin-change interrupt 0

	Detects pin changes on PCINT0-7 (all masked on), i.e. PB0-7 on Atmega2560

	It compares these values to the last known state and signals a change
	on any pins that have changed state.

*/
ISR(PCINT0_vect)
{
	uint8_t temp = lastState^PINB;
	lastState = PINB;

	if ((temp &amp; _BV(0)))
		signalChangedState(0,2);
	if ((temp &amp; _BV(1)))
		signalChangedState(1,3);
	if ((temp &amp; _BV(2)))
		signalChangedState(2,4);
	if ((temp &amp; _BV(3)))
		signalChangedState(3,5);
	if ((temp &amp; _BV(4)))
		signalChangedState(4,20);
	if ((temp &amp; _BV(5)))
		signalChangedState(5,50);
	if ((temp &amp; _BV(6)))
		signalChangedState(6,200);
	if ((temp &amp; _BV(7)))
		signalChangedState(7,200);
}

int main(void)
{
	//Initialize PORTB as all inputs, no internal pull-ups
	DDRB  = 0x00;
	PORTB = 0x00;

	//Initialize PORTD as all outputs, all HIGH (LEDs off)
	DDRD  = 0xFF;
	PORTD = 0xFF;

	//Initial timer setup (does not start timer)
	initializeDebouncerTimer();

	lastState = PINB;

	//Fills in details regarding
	registerDebouncer(&amp;PINB,PB0,0,1,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB1,1,1,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB2,2,1,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB3,3,1,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB4,4,0,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB5,5,0,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB6,6,0,&amp;ButtonClicker);
	registerDebouncer(&amp;PINB,PB7,7,0,&amp;ButtonClicker);

	//Enable pin-change interrupt &amp; mask
	PCICR  = _BV(PCIE0);
	PCMSK0 = 0xFF;

	//Enable interrupts
	sei();

	while(1)
	{
		//This will loop through any signaled debouncer items and
		//call their handlers (doesn't apply to asynchronous)
		callSignaledHandlers();

		_delay_ms(5);
	}

	return 0;
}

void ButtonClicker(uint8_t index,uint8_t state)
{
	if (state == 0)
	{

		PORTD ^= _BV(index);
	}
}
</pre></p>
<h2>William Dillon&#8217;s Debounce Code</h2>
<p>Uses rising and falling edge detection in software to create a digital filter.</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/* uint8_t doDebounce(uint8_t *state, volatile uint8_t *port, uint8_t pin)
 *
 * This function implements the logic for detecting button transitions for
 * arbitrary ports and bits.  The return value is the debounced value the the
 * given pin.
 *
 * The implementation of this function is inspired by the digital filter
 * presented in ECE573 at Oregon State University.  It is different because
 * I'm using the single 8-bit variable to store all of the state, rather than a
 * 8 bit accumulator and 8 bit flag.  We're using the range from 0x00 -&gt; 0x7F
 * and bit 7 (0x80) as the flag.
 *
 * The user of this function must provide a static state variable.  This
 * value encodes the state and history of the pin  Failure to maintain the state
 * would cause erratic behavior.  The port can be any of the PINn
 * memory-mapped input buffers.  Pin must be between 0 and 7.
 *
 * Because these buttons pull to ground, we'll invert the meaning of the edges
 * in software, 1 = yes is much more natural.
 */
uint8_t doDebounce(uint8_t *state, volatile uint8_t *port, uint8_t pin) {
       uint8_t old  =  *state &amp; 0x7F;
       uint8_t flag = (*state &amp; 0x80)? 1 : 0;

       // Digital filter part, value = (old * .75) + (new * .25)
       old -= (old &gt;&gt; 2);                                                              // 1 - (1/4) = .75
       old += ((*port) &amp; (1 &lt;&lt; pin))? 0x1F : 0x00;             // if bit set, add .25

       // Software schmitt trigger
       // Newly detected rising edge
       if ( (flag == 1) &amp;&amp; (old &gt; 0x70) ) {
               flag = 0;
       }

       // Newly detected falling edge
       else if ( (flag == 0) &amp;&amp; (old &lt; 0x07) ){
               flag = 1;
       }

       // Update the state variable
       *state = (old &amp; 0x7F) | ((flag &amp; 0x01) &lt;&lt; 7);

       // Return only the pin state
       return flag;
}</pre></p>
<h2>Mike Szczys&#8217; Debounce Code</h2>
<p>I fell in love with the Danni Debounce code early on. Here&#8217;s my retouched version of it.</p>
<p><pre class="brush: cpp; collapse: true; light: false; toolbar: true; wrap-lines: false;">/*--------------------------------------------------------------------------
10/13/2010: Button debounce code by Mike Szczys

based on &quot;danni debounce&quot; code by Peter Dannegger:

http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;p=189356#189356

This code detects and debounces button presses. It is tailored for use with
AVR microcontrollers but I've adapted it for other architectures easily and
successfully. It can be modified to use all eight bits on the same port
for up to eight buttons.

The interrupt service routine (ISR) at the bottom uses binary counter
variables (ct0 and ct1) to check the buttons once every 10ms until 40ms has
passed. If the button registeres the first and last times it reads it as
a keypress. There is no functionality in this code for detecting a held
button.
--------------------------------------------------------------------------*/

// F_CPU used by debounce to calculate 10ms interrupts
#define F_CPU 1200000

#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;

//define pins used by buttons
#define KEY_DDR		DDRB
#define KEY_PORT	PORTB
#define KEY_PIN		PINB
#define KEY0		1	//Button on PB1
#define KEY1		2	//Button on PB2

//Debounce variables
unsigned char debounce_cnt = 0;
volatile unsigned char key_press;
unsigned char key_state;

/*--------------------------------------------------------------------------
  Prototypes
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask );
void init_timers(void);
void init_io(void);

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Used to read debounced button presses
  PARAMS: A keymask corresponding to the pin for the button you with to poll
  RETURNS: A keymask where any high bits represent a button press
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask )
{
  cli();			// read and clear atomic !
  key_mask &amp;= key_press;	// read key(s)
  key_press ^= key_mask;	// clear key(s)
  sei();			// enable interrupts
  return key_mask;
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Sets and starts a system timer
  PARAMS: NONE
  RETURNS: NONE
--------------------------------------------------------------------------*/
void init_timers(void)
{
  cli();			// read and clear atomic !
  //Timer0 for buttons
  TCCR0B |= 1&lt;&lt;CS02 | 1&lt;&lt;CS00;	//Divide by 1024
  TIMSK0 |= 1&lt;&lt;TOIE0;		//enable timer overflow interrupt
  sei();			// enable interrupts
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Initialize input and output registers
  PARAMS: NONE
  RETURNS: NONE
--------------------------------------------------------------------------*/
void init_io(void)
{
  //Setup Buttons
  KEY_DDR &amp;= ~((1&lt;&lt;KEY0) | (1&lt;&lt;KEY1));	//Set pins as input
  KEY_PORT |= (1&lt;&lt;KEY0) | (1&lt;&lt;KEY1);	//enable pull-up resistors
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Main
--------------------------------------------------------------------------*/
int main(void)
{
  init_timers();	//start the timer
  init_io();		//setup the buttons

  for (;;) //loop forever
  {
    if( get_key_press( 1&lt;&lt;KEY0 ))
    {
      //KEY0 press detected. Do something here
    }

    if (get_key_press( 1&lt;&lt;KEY1 ))
    {
      //KEY1 press detected. Do something here
    }
  }
}

//--------------------------------------------------------------------------
ISR(TIM0_OVF_vect)           // interrupt every 10ms
{
  static unsigned char ct0, ct1;
  unsigned char i;

  //TCNT0 is where TIMER0 starts counting. This calculates a value based on
  //the system clock speed that will cause the timer to reach an overflow
  //after exactly 10ms
  TCNT0 = (unsigned char)(signed short)-(((F_CPU / 1024) * .01) + 0.5);   // preload for 10ms interrupts

  i = key_state ^ ~KEY_PIN;    // key changed ?
  ct0 = ~( ct0 &amp; i );          // reset or count ct0
  ct1 = ct0 ^ (ct1 &amp; i);       // reset or count ct1
  i &amp;= ct0 &amp; ct1;              // count until roll over ?
  key_state ^= i;              // then toggle debounced state
  key_press |= key_state &amp; i;  // 0-&gt;1: key press detect
}</pre></p>
<p><span style="font-size:20px;font-weight:bold;">Links to other code</span></p>
<p>Some folks just sent us links to code. Here they are:</p>
<p>[Pieter Conradie's] <a href="http://www.piconomic.co.za/fwlib/group___k_b_d___m_a_t_r_i_x.html">matrix scanning code</a>.</p>
<p>[Hernandi F. Krammes'] <a href="http://formfeed.blogspot.com/2010/10/debounce-machine-i-state-approach.html">debounce code for PIC</a>.</p>
<p>[Dave] uses [Jack Ganssle's] debounce code; Listing 2 of <a href="http://www.ganssle.com/debouncing-pt2.htm">this page</a>.</p>
<p>&nbsp;</p>
<p>[Photo credit: <a href="http://www.ganssle.com/debouncing.htm">Jack Ganssle</a>]</p>
<br />Filed under: <a href='http://hackaday.com/category/microcontrollers/'>Microcontrollers</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29916/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29916/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29916/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29916&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/11/09/debounce-code-one-post-to-rule-them-all/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/debounce-waveform.jpg" medium="image">
			<media:title type="html">debounce-waveform</media:title>
		</media:content>
	</item>
		<item>
		<title>Waterproof DIY momentary-push switch</title>
		<link>http://hackaday.com/2010/10/20/waterproof-diy-momentary-push-switch/</link>
		<comments>http://hackaday.com/2010/10/20/waterproof-diy-momentary-push-switch/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 19:34:30 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[peripherals hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[copper foil]]></category>
		<category><![CDATA[momentary push]]></category>
		<category><![CDATA[paintball]]></category>
		<category><![CDATA[scope]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29527</guid>
		<description><![CDATA[[Patman2700] has a nice scope for his paintball gun that uses a red dot instead of cross-hairs. The problem is that he kept forgetting to turn it off which ended up running the batteries down frequently. His solution to the problem was to get rid of the toggle switch used to turn it on and replace [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29527&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29528" title="diy-contact-switch" src="http://hackadaycom.files.wordpress.com/2010/10/diy-contact-switch.jpg" alt="" width="500" height="375" /></p>
<p>[Patman2700] has a nice scope for his paintball gun that uses a red dot instead of cross-hairs. The problem is that he kept forgetting to turn it off which ended up running the batteries down frequently. His solution to the problem was to get rid of the toggle switch used to turn it on and replace it will <a href="http://www.instructables.com/id/How-To-Make-a-Free-Tactical-Pressure-Switch/">a home-made momentary push button switch</a>. Now he presses the switch to aim and doesn&#8217;t waste juice when he&#8217;s running around, trying not to get pelted with paint.</p>
<p>Since this is used outside he wanted it to be water-tight. The switch is built using materials we&#8217;ve seen in <a href="http://hackaday.com/2010/10/05/build-a-simple-switch/">previous diy switches</a>; adhesive-backed copper sheets for conductors, foam to keep them separated until pressed, and plastic as a support. Copper is applied to the plastic base, with a ring of foam separating the base from the second layer of copper. When squeezed, the two layers of copper come in contact to complete the circuit. To make it work a bit better [Patman2700] added a dab of solder in the center of the bottom copper layer so there is less distance between conductors, and used extra foam to build up a bump in the center of the assembly for a better &#8216;button&#8217; feel. The whole thing is encased in shrink-wrap with the seams sealed with super glue to keep moisture at bay.</p>
<br />Filed under: <a href='http://hackaday.com/category/peripherals-hacks/'>peripherals hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29527/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29527/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29527/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29527&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/10/20/waterproof-diy-momentary-push-switch/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/diy-contact-switch.jpg" medium="image">
			<media:title type="html">diy-contact-switch</media:title>
		</media:content>
	</item>
		<item>
		<title>Open Call: send us your Debounce code</title>
		<link>http://hackaday.com/2010/10/13/open-call-send-us-your-debounce-code/</link>
		<comments>http://hackaday.com/2010/10/13/open-call-send-us-your-debounce-code/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 20:11:32 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[HackIt]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[debounce]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=29271</guid>
		<description><![CDATA[If you&#8217;ve ever designed an embedded system with at least one button you&#8217;ve had to deal with button debouncing. This is also know as contact bounce, a phenomenon where a button press can be registered as multiple button presses if not handled correctly. One way to take care of this is with a hardware filter built from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29271&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-29272" title="debounce-waveform" src="http://hackadaycom.files.wordpress.com/2010/10/debounce-waveform.jpg" alt="" width="470" height="244" /></p>
<p>If you&#8217;ve ever designed an embedded system with at least one button you&#8217;ve had to deal with button debouncing. This is also know as <a href="http://en.wikipedia.org/wiki/Debounce#Contact_bounce">contact bounce</a>, a phenomenon where a button press can be registered as multiple button presses if not handled correctly. One way to take care of this is with a hardware filter built from a resistor-capacitor setup, or by using a couple of NAND gates. We find that [Jack Ganssle] put together the most comprehensive and <a href="http://www.ganssle.com/debouncing.htm">approachable look at contact bounce</a> which you should read through if you want to learn more.</p>
<p>We&#8217;re interested in software solutions for debouncing buttons. This seems to be <a href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;t=33821">one of the most common forum questions</a> but it can be hard to find answers in the form of reliable code examples. Do you have debounce code that you depend on in every application? Are you willing to share it with the world? We&#8217;d like to gather as many examples as possible and publish them in one-post-to-rule-them-all.</p>
<h2>Send your debounce code to: <a href="mailto:debounce@hackaday.com">debounce@hackaday.com</a></h2>
<p>Here&#8217;s some guidelines to follow:</p>
<ul>
<li><strong>Please only include debounce code.</strong> Get rid of other unrelated functions/etc.</li>
<li><strong>You should send C code.</strong> If you want to also send an assembly code version that&#8217;s fine, but it must be supplementary to the C code.</li>
<li><strong>Please comment your code.</strong> This will help others understand and use it. You may be tempted to explain the code in your email but this info is best placed in the code comments</li>
<li><strong>Cite your sources.</strong> If you adapted this code from someone else&#8217;s please include a note about that in the code comments.</li>
</ul>
<p>As an example we&#8217;ve included one of our favorite sets of debounce code after the break. Please note how it follows the guidelines listed above.</p>
<p><span id="more-29271"></span></p>
<p><pre class="brush: cpp; wrap-lines: false;">/*--------------------------------------------------------------------------
10/13/2010: Button debounce code by Mike Szczys

based on &quot;danni debounce&quot; code by Peter Dannegger:
http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;file=viewtopic&amp;p=189356#189356

This code detects and debounces button presses. It is tailored for use with
AVR microcontrollers but I've adapted it for other architectures easily and
successfully. It can be modified to use all eight bits on the same port
for up to eight buttons.

The interrupt service routine (ISR) at the bottom uses binary counter
variables (ct0 and ct1) to check the buttons once every 10ms until 40ms has
passed. If the button registeres the first and last times it reads it as
a keypress. There is no functionality in this code for detecting a held
button.
--------------------------------------------------------------------------*/

// F_CPU used by debounce to calculate 10ms interrupts
#define F_CPU 1200000

#include &lt;avr/io.h&gt;
#include &lt;avr/interrupt.h&gt;

//define pins used by buttons
#define KEY_DDR		DDRB
#define KEY_PORT	PORTB
#define KEY_PIN		PINB
#define KEY0		1	//Button on PB1
#define KEY1		2	//Button on PB2

//Debounce variables
unsigned char debounce_cnt = 0;
volatile unsigned char key_press;
unsigned char key_state;

/*--------------------------------------------------------------------------
  Prototypes
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask );
void init_timers(void);
void init_io(void);

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Used to read debounced button presses
  PARAMS: A keymask corresponding to the pin for the button you with to poll
  RETURNS: A keymask where any high bits represent a button press
--------------------------------------------------------------------------*/
unsigned char get_key_press( unsigned char key_mask )
{
  cli();			// read and clear atomic !
  key_mask &amp;= key_press;	// read key(s)
  key_press ^= key_mask;	// clear key(s)
  sei();			// enable interrupts
  return key_mask;
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Sets and starts a system timer
  PARAMS: NONE
  RETURNS: NONE
--------------------------------------------------------------------------*/
void init_timers(void)
{
  cli();			// read and clear atomic !
  //Timer0 for buttons
  TCCR0B |= 1&lt;&lt;CS02 | 1&lt;&lt;CS00;	//Divide by 1024
  TIMSK0 |= 1&lt;&lt;TOIE0;		//enable timer overflow interrupt
  sei();			// enable interrupts
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Initialize input and output registers
  PARAMS: NONE
  RETURNS: NONE
--------------------------------------------------------------------------*/
void init_io(void)
{
  //Setup Buttons
  KEY_DDR &amp;= ~((1&lt;&lt;KEY0) | (1&lt;&lt;KEY1));	//Set pins as input
  KEY_PORT |= (1&lt;&lt;KEY0) | (1&lt;&lt;KEY1);	//enable pull-up resistors
}

/*--------------------------------------------------------------------------
  FUNC: 10/13/10 - Main
--------------------------------------------------------------------------*/
int main(void)
{
  init_timers();	//start the timer
  init_io();		//setup the buttons

  for (;;) //loop forever
  {
    if( get_key_press( 1&lt;&lt;KEY0 ))
    {
      //KEY0 press detected. Do something here
    }

    if (get_key_press( 1&lt;&lt;KEY1 ))
    {
      //KEY1 press detected. Do something here
    }
  }
}

//--------------------------------------------------------------------------
ISR(TIM0_OVF_vect)           // interrupt every 10ms
{
  static unsigned char ct0, ct1;
  unsigned char i;

  //TCNT0 is where TIMER0 starts counting. This calculates a value based on
  //the system clock speed that will cause the timer to reach an overflow
  //after exactly 10ms
  TCNT0 = (unsigned char)(signed short)-(((F_CPU / 1024) * .01) + 0.5);   // preload for 10ms interrupts

  i = key_state ^ ~KEY_PIN;    // key changed ?
  ct0 = ~( ct0 &amp; i );          // reset or count ct0
  ct1 = ct0 ^ (ct1 &amp; i);       // reset or count ct1
  i &amp;= ct0 &amp; ct1;              // count until roll over ?
  key_state ^= i;              // then toggle debounced state
  key_press |= key_state &amp; i;  // 0-&gt;1: key press detect
}</pre></p>
<p>[Photo credit: <a href="http://www.ganssle.com/debouncing.htm">Jack Ganssle</a>]</p>
<br />Filed under: <a href='http://hackaday.com/category/hackit/'>HackIt</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/29271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/29271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/29271/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=29271&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/10/13/open-call-send-us-your-debounce-code/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/debounce-waveform.jpg" medium="image">
			<media:title type="html">debounce-waveform</media:title>
		</media:content>
	</item>
		<item>
		<title>Build a simple switch</title>
		<link>http://hackaday.com/2010/10/05/build-a-simple-switch/</link>
		<comments>http://hackaday.com/2010/10/05/build-a-simple-switch/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 21:00:57 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[peripherals hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[copper]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[velcro]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=28968</guid>
		<description><![CDATA[Forget hacking an easy button, grab a couple of those outdated CD-Rs and build your own switch for that next project. This was developed with handicapped accessibility in mind; assembled easily with common products and it&#8217;s fairly robust. In fact, our junk box has everything you need except the adhesive backed copper foil. Combine two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=28968&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-28970" title="a-simple-switch" src="http://hackadaycom.files.wordpress.com/2010/10/a-simple-switch-e1286293732487.jpg" alt="" width="470" height="353" /></p>
<p>Forget hacking an easy button, grab a couple of those outdated CD-Rs and <a href="http://www.instructables.com/id/CD-Switch">build your own switch</a> for that next project. This was developed with handicapped accessibility in mind; assembled easily with common products and it&#8217;s fairly robust. In fact, our junk box has everything you need except the adhesive backed copper foil. Combine two old CD&#8217;s, covered in copper on facing sides, separated by two strips of Velcro to separate the conductors. When pressure is applied, one CD flexes to make contact with the other and complete the circuit. So easy, yet we never thought of it. We&#8217;ll add it to our list of <a href="http://hackaday.com/2010/02/27/two-input-devices-made-with-common-items/">homebrew input devices</a>.</p>
<p>[Thanks Michael]</p>
<br />Filed under: <a href='http://hackaday.com/category/peripherals-hacks/'>peripherals hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/28968/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/28968/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/28968/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=28968&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/10/05/build-a-simple-switch/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/10/a-simple-switch-e1286293732487.jpg" medium="image">
			<media:title type="html">a-simple-switch</media:title>
		</media:content>
	</item>
		<item>
		<title>Pure TTL based clock</title>
		<link>http://hackaday.com/2010/03/16/pure-ttl-based-clock/</link>
		<comments>http://hackaday.com/2010/03/16/pure-ttl-based-clock/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 20:00:13 +0000</pubDate>
		<dc:creator>Jakob Griffith</dc:creator>
				<category><![CDATA[clock hacks]]></category>
		<category><![CDATA[7400]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[crystal]]></category>
		<category><![CDATA[divider]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[multivibrator]]></category>
		<category><![CDATA[oscillator]]></category>
		<category><![CDATA[signal]]></category>
		<category><![CDATA[ttl]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=22422</guid>
		<description><![CDATA[We&#8217;ll just say, [Kenneth] really likes clocks. His most recent is a pure 7400 series TTL based one, ie no microcontroller as seen in the past, here, here, and here. The signal starts out as a typical 32,768 crystal divided down to the necessary 1Hz, which is then divided again appropriately to provide hours and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=22422&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-22423" title="I will give a shiny nickle to whoever can make a 12 hour 7400 series based TTL clock." src="http://hackadaycom.files.wordpress.com/2010/03/img_0549.jpg" alt="" width="470" height="353" /></p>
<p>We&#8217;ll just say, [Kenneth] really likes clocks. His most recent is a <a href="http://kennethfinnegan.blogspot.com/2010/03/pure-ttl-clock.html">pure 7400 series TTL based one</a>, ie no microcontroller as seen in <a href="http://hackaday.com/2010/02/17/binary-clock-uses-ds3232-rtc/">the past</a>, <a href="http://kennethfinnegan.blogspot.com/2009/11/seven-segment-led-arduino-clock.html">here</a>, <a href="http://kennethfinnegan.blogspot.com/2010/01/arduino-four-digit-clock.html">here</a>, and <a href="http://kennethfinnegan.blogspot.com/2010/01/arduino-binary-clock.html">here</a>. The signal starts out as a typical 32,768 crystal divided down to the necessary 1Hz, which is then divided again appropriately to provide hours and minutes.</p>
<p>As far as TTL clocks go, this is nothing too original; until it comes to his creative button interface. By using a <span style="text-decoration:line-through;">not as sexy as it sounds</span> multivibrator, he can produce a clean square wave instead of the figity signals produced from buttons to advance and set the time. Like always, he also provides us with a thorough breakdown of his clock, after the jump.<span id="more-22422"></span></p>
<span style="text-align:center; display: block;"><a href="http://hackaday.com/2010/03/16/pure-ttl-based-clock/"><img src="http://img.youtube.com/vi/rzDe7GBJ0V8/2.jpg" alt="" /></a></span>
<br />Filed under: <a href='http://hackaday.com/category/clock-hacks/'>clock hacks</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/22422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/22422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/22422/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=22422&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2010/03/16/pure-ttl-based-clock/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Jakob Griffith</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2010/03/img_0549.jpg" medium="image">
			<media:title type="html">I will give a shiny nickle to whoever can make a 12 hour 7400 series based TTL clock.</media:title>
		</media:content>
	</item>
		<item>
		<title>Shadow buttons</title>
		<link>http://hackaday.com/2009/12/28/shadow-buttons/</link>
		<comments>http://hackaday.com/2009/12/28/shadow-buttons/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 21:00:50 +0000</pubDate>
		<dc:creator>Mike Szczys</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[emgu]]></category>
		<category><![CDATA[midi]]></category>
		<category><![CDATA[projector]]></category>
		<category><![CDATA[shadow]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=19981</guid>
		<description><![CDATA[This art installation uses buttons made of light. A projector fills up the walls and ceiling of a room while a webcam monitors the pattern for changes. When the luminosity of a given area changes due to a shadow, a midi event is triggered. The software that controls the system is written in C# and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=19981&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-19982" title="shadow-buttons" src="http://hackadaycom.files.wordpress.com/2009/12/shadow-buttons.jpg" alt="" width="470" height="282" /></p>
<p><a href="http://azislodowy.blogspot.com/2009/12/video-mapping-installation.html">This art installation</a> uses buttons made of light. A projector fills up the walls and ceiling of a room while a webcam monitors the pattern for changes. When the luminosity of a given area changes due to a shadow, a midi event is triggered. The software that controls the system is written in C# and uses the <a href="http://www.emgu.com/wiki/index.php/Main_Page">Emgu CV library</a> to handle the image processing. In the video after the break you can see that creating shadows with your hands prompts changes in the image as well as the sound.</p>
<p><span id="more-19981"></span><div class='embed-vimeo' style='text-align:center;'><iframe src='http://player.vimeo.com/video/8262403' width='400' height='300' frameborder='0'></iframe></div></p>
<br />Posted in misc hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/19981/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/19981/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/19981/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=19981&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/12/28/shadow-buttons/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Mike Szczys</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/12/shadow-buttons.jpg" medium="image">
			<media:title type="html">shadow-buttons</media:title>
		</media:content>
	</item>
		<item>
		<title>Push potentiometer from spares</title>
		<link>http://hackaday.com/2009/08/28/push-potentiometer-from-spares/</link>
		<comments>http://hackaday.com/2009/08/28/push-potentiometer-from-spares/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 13:28:31 +0000</pubDate>
		<dc:creator>Caleb Kraft</dc:creator>
				<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[potentiometer]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=14055</guid>
		<description><![CDATA[In an effort to simplify his interface, [danwagoner] cobbled together this push potentiometer. It utilizes a potentiometer mounted directly above a push button with a spring mounted around it. This way the user has only one item to deal with. They can twist the knob and press down on it to push the button.  We [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=14055&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-14056" title="ppot" src="http://hackadaycom.files.wordpress.com/2009/08/ppot.jpg" alt="ppot" width="470" height="353" /></p>
<p>In an effort to simplify his interface, [danwagoner] cobbled together this <a href="http://www.flickr.com/photos/danwagoner/3863936966/in/photostream/">push potentiometer</a>. It utilizes a potentiometer mounted directly above a push button with a spring mounted around it. This way the user has only one item to deal with. They can twist the knob and press down on it to push the button.  We love seeing people come up with ways of creating their own items instead of buying something. This was fairly inventive and reminds us of the <a href="http://hackaday.com/2009/01/29/led-push-buttons/">LED buttons</a> we saw back in January. Great job [danwagoner].</p>
<br />Posted in tool hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/14055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/14055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/14055/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=14055&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/08/28/push-potentiometer-from-spares/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Caleb Kraft</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/08/ppot.jpg" medium="image">
			<media:title type="html">ppot</media:title>
		</media:content>
	</item>
		<item>
		<title>LED push buttons</title>
		<link>http://hackaday.com/2009/01/29/led-push-buttons/</link>
		<comments>http://hackaday.com/2009/01/29/led-push-buttons/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 16:56:59 +0000</pubDate>
		<dc:creator>Caleb Kraft</dc:creator>
				<category><![CDATA[classic hacks]]></category>
		<category><![CDATA[led hacks]]></category>
		<category><![CDATA[tool hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[led]]></category>

		<guid isPermaLink="false">http://hackaday.com/?p=8257</guid>
		<description><![CDATA[[pros] has come up with a very elegant way of making lighted buttons (translated). Using a bunch of small push buttons harvested from old CD players, he rigged this unique way of mounting LEDs. Each LED has two buttons under it. They are wired in parallel, so if either of them is pushed, the button [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=8257&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-8256" title="led-button" src="http://hackadaycom.files.wordpress.com/2009/01/led-button.jpg" alt="led-button" width="450" height="325" /></p>
<p>[pros] has come up with a <a href="http://translate.google.com/translate?prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=http%3A%2F%2Fwww.circuitsonline.net%2Fforum%2Fview%2F46678&amp;sl=nl&amp;tl=en&amp;history_state0=">very elegant way of making lighted buttons</a> (<a href="http://translate.google.com/translate?prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=http%3A%2F%2Fwww.circuitsonline.net%2Fforum%2Fview%2F46678&amp;sl=nl&amp;tl=en&amp;history_state0=">translated</a>). Using a bunch of small push buttons harvested from old CD players, he rigged this unique way of mounting LEDs. Each LED has two buttons under it. They are wired in parallel, so if either of them is pushed, the button works. The LED isn&#8217;t actually soldered where it passes through the board. The anode and cathode are bent around and soldered to allow the LED a little bit of travel.  There&#8217;s a good picture of how he did this on the site. The rest of the details might be hard to decipher though, it looks to be in dutch.</p>
<p>[thanks Tom]</p>
<br />Posted in classic hacks, led hacks, tool hacks  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/8257/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/8257/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/8257/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=8257&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2009/01/29/led-push-buttons/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Caleb Kraft</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2009/01/led-button.jpg" medium="image">
			<media:title type="html">led-button</media:title>
		</media:content>
	</item>
		<item>
		<title>Parts: Tactile switches for your next project</title>
		<link>http://hackaday.com/2008/09/15/tact-switches-for-your-next-project/</link>
		<comments>http://hackaday.com/2008/09/15/tact-switches-for-your-next-project/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 19:02:41 +0000</pubDate>
		<dc:creator>Ian</dc:creator>
				<category><![CDATA[classic hacks]]></category>
		<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[parts]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[choosing parts]]></category>
		<category><![CDATA[components]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[tact switches]]></category>
		<category><![CDATA[tactile switch]]></category>

		<guid isPermaLink="false">http://hackadaycom.wordpress.com/?p=2919</guid>
		<description><![CDATA[Electronics parts can be a pain to choose. It&#8217;s often hard to tell from manufacturers&#8217; datasheets if a part will fit your design. We auditioned six different tactile switches to find a cheap button to use in upcoming projects. A tactile switch, also called a momentary button or push-to-make switch, is commonly used for input [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=2919&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-3151" title="buttons1" src="http://hackadaycom.files.wordpress.com/2008/09/buttons1.jpg" alt="" width="450" height="279" /></p>
<p>Electronics parts can be a pain to choose. It&#8217;s often hard to tell from manufacturers&#8217; datasheets if a part will fit your design. We auditioned six different tactile switches to find a cheap button to use in upcoming projects. A tactile switch, also called a momentary button or <a href="http://en.wikipedia.org/wiki/Switch#Biased_switches">push-to-make switch</a>, is commonly used for input and microcontroller resets. This type of button creates a temporary electrical connection when pressed.</p>
<p>Footprints for most of these buttons are available in the <a href="http://www.cadsoft.de/">Cadsoft Eagle</a> library <em>switch-tac</em>, or in the <a href="http://www.opencircuits.com/SFE_Footprint_Library_Eagle">Sparkfun parts library</a> under <em>TAC_SWITCH</em>. Buttons in the image above are discussed from left to right.<span id="more-2919"></span></p>
<p><strong><span>Through hole push button switch (6mm):</span></strong><span> </span><span>This switch will appeal to fans of through-hole parts, but you can see that it&#8217;s actually smaller than the 6x6mm surface mount buttons.</span><span> Note that it does not have the standard 0.1&#8243; straight mounting legs, and thus won&#8217;t fit in a breadboard. Common package name(s): DTS-3 (S1 above).<br />
</span></p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=MJTP1250virtualkey64200000virtualkey642-MJTP1250"><span>642-MJTP1250</span></a> (16 cents)</p>
<p><span><strong>Regular SMD tactile switches (6 X 6mm):</strong><em> </em>A 6 x 6mm tactile switch is probably the most common surface mount button. Even though it&#8217;s surface mount, it&#8217;s large and easy to solder.  The button has two pairs of leads (1&amp;2, 3&amp;4) that connect internally to the same switch &#8212; although there are four legs you only get a single switch. You only need to connect one pin from each pair to use the button, but it makes no difference if you decide to connect both. The yellow and red buttons are rated in terms of the force required for activation (gf), yellow requires the most force (520gf) and makes the loudest snap. Common package name(s): DTS-6 (S2 above).<br />
</span></p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=101-0164-EVvirtualkey12040000virtualkey101-0164-EV"><span>101-0164-EV</span></a> (22 cents)</p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=101-TS5922T5202-EVvirtualkey12040000virtualkey101-TS5922T5202-EV">101-TS5922T5202-EV</a> <span>520gf YELLOW (36 cents)</span></p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=101-TS6824T2604-EVvirtualkey12040000virtualkey101-TS6824T2604-EV">101-TS6824T2604-EV</a> <span>260gf RED SMT (51 cents)</span></p>
<p><span><strong>Small SMD tactile switches (4.5&#215;4.5&#215;0.4mm):</strong> Unlike the previous buttons, these tiny switches require practice and skill to solder. While the mounting area is only 12% smaller than the previous buttons, the leads are tiny and hidden under the package. Like the 6 x 6mm tactile switches, these are rated in terms of actuation force (gf). We were unable to find a ready-made footprint for this part.<br />
</span></p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=SKRMAAE010virtualkey68800000virtualkey688-SKRMAA"><span>688-SKRMAA</span></a><span> 160gf (30 cents)</span><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=SKRMAAE010virtualkey68800000virtualkey688-SKRMAA"><span><br />
</span></a></p>
<p><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=SKRMABE010virtualkey68800000virtualkey688-SKRMAB"><span>688-SKRMAB</span></a><span> </span><span>260gf (30 cents)</span><a href="http://www.mouser.com/Search/ProductDetail.aspx?R=SKRMABE010virtualkey68800000virtualkey688-SKRMAB"><span><br />
</span></a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hackadaycom.wordpress.com/2919/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hackadaycom.wordpress.com/2919/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/2919/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/2919/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/2919/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=2919&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2008/09/15/tact-switches-for-your-next-project/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">Ian</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/09/buttons1.jpg" medium="image">
			<media:title type="html">buttons1</media:title>
		</media:content>
	</item>
		<item>
		<title>PSP L2/R2 button mod</title>
		<link>http://hackaday.com/2008/06/14/psp-l2r2-button-mod/</link>
		<comments>http://hackaday.com/2008/06/14/psp-l2r2-button-mod/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 23:10:00 +0000</pubDate>
		<dc:creator>Eliot</dc:creator>
				<category><![CDATA[playstation hacks]]></category>
		<category><![CDATA[psp hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[engadget]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[playstation]]></category>
		<category><![CDATA[ps1]]></category>
		<category><![CDATA[psp]]></category>
		<category><![CDATA[psx]]></category>
		<category><![CDATA[sony]]></category>
		<category><![CDATA[switch]]></category>

		<guid isPermaLink="false">http://hackaday.iheartcashews.com:8181/2008/06/14/psp-l2r2-button-mod/</guid>
		<description><![CDATA[This is quickly becoming an unintentional &#8220;game controller Saturday&#8221;. We haven&#8217;t been covering the PSP much lately, so this is a treat. AcidMods forum member [Electro] put together a quick guide for adding two missing shoulder buttons to the PSP. The L2 and R2 buttons are used while playing Playstation 1 games and are usually [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=2001&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img width="450" vspace="4" hspace="4" height="159" border="0" src="http://hackadaycom.files.wordpress.com/2008/06/had_psp.jpg?w=450&#038;h=159" alt="" /><br />This is quickly becoming an unintentional &#8220;game controller Saturday&#8221;. We haven&#8217;t been covering the PSP much lately, so this is a treat. AcidMods forum member [Electro] put together a quick guide for <a href="http://www.acidmods.com/forum/index.php?topic=15108.0">adding two missing shoulder buttons to the PSP</a>. The L2 and R2 buttons are used while playing Playstation 1 games and are usually mapped to directions on the joystick. This mod jumps the joystick&#8217;s contacts an relocates the buttons to the shoulders. The switches used in the post seem kind of bulky, but you&#8217;re free to use anything that fits.</p>
<p>[via <a href="http://www.engadget.com/2008/06/14/psp-l2-and-r2-button-mod-aint-pretty-gets-the-job-done/">Engadget</a>]</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hackadaycom.wordpress.com/2001/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hackadaycom.wordpress.com/2001/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/2001/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/2001/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/2001/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=2001&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2008/06/14/psp-l2r2-button-mod/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">RobotSkirts</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/06/had_psp.jpg" medium="image" />
	</item>
		<item>
		<title>Tips on picking the right case</title>
		<link>http://hackaday.com/2008/06/06/tips-on-picking-the-right-case/</link>
		<comments>http://hackaday.com/2008/06/06/tips-on-picking-the-right-case/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 05:00:00 +0000</pubDate>
		<dc:creator>Juan Aguilar</dc:creator>
				<category><![CDATA[misc hacks]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[casemod]]></category>
		<category><![CDATA[cases]]></category>
		<category><![CDATA[enclosure]]></category>
		<category><![CDATA[enclosures]]></category>
		<category><![CDATA[sparkfun]]></category>

		<guid isPermaLink="false">http://hackaday.iheartcashews.com:8181/2008/06/06/tips-on-picking-the-right-case/</guid>
		<description><![CDATA[Finding the right enclosure to house your latest project can be tricky, so Sparkfun wrote up some handy tips on the how to pick the right one. The most important tip is to have your components measured before acquiring a case; even being a few milimeters too small can put you back at square one. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=1940&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img width="450" vspace="4" hspace="4" height="307" border="0" alt=""  src="http://hackadaycom.files.wordpress.com/2008/06/had_project.jpg?w=450&#038;h=307" /><br />Finding the right enclosure to house your latest project can be tricky, so <a href="http://www.sparkfun.com/commerce/present.php?p=Enclosure-Modification">Sparkfun wrote up some handy tips</a> on the how to pick the right one.</p>
<p>The most important tip is to have your components measured before acquiring a case; even being a few milimeters too small can put you back at square one. To do this right, it&#8217;s useful to look at the dimensional drawings of prospective cases to get a sense for the size. These typically include recommended shapes for PCBs too. </p>
<p>You may find a case that meets your dimensional needs but doesn&#8217;t have the appropriate mounting bosses. To get the placement right, screw some plastic standoffs to the PCB, then use super glue to attach them firmly to the case. </p>
<p>Tips on button choices, hole drilling, and other typical issues with case modification can also be found in this guide. If this is something that&#8217;s been stumping you, give it a look.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/hackadaycom.wordpress.com/1940/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/hackadaycom.wordpress.com/1940/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hackadaycom.wordpress.com/1940/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hackadaycom.wordpress.com/1940/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hackadaycom.wordpress.com/1940/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hackaday.com&amp;blog=4779443&amp;post=1940&amp;subd=hackadaycom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hackaday.com/2008/06/06/tips-on-picking-the-right-case/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">juanaguilar</media:title>
		</media:content>

		<media:content url="http://hackadaycom.files.wordpress.com/2008/06/had_project.jpg" medium="image" />
	</item>
	</channel>
</rss>
