<?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/"
	>

<channel>
	<title>Ben Dauphinee - Blog</title>
	<atom:link href="http://blog.bendauphinee.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bendauphinee.com</link>
	<description></description>
	<lastBuildDate>Thu, 10 May 2012 15:23:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jQuery and Form Submit Breaking</title>
		<link>http://blog.bendauphinee.com/2012/05/never-forget-jquery-and-form-submit-breaking/</link>
		<comments>http://blog.bendauphinee.com/2012/05/never-forget-jquery-and-form-submit-breaking/#comments</comments>
		<pubDate>Thu, 10 May 2012 15:22:59 +0000</pubDate>
		<dc:creator>Ben Dauphinee</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[submit]]></category>

		<guid isPermaLink="false">http://blog.bendauphinee.com/?p=166</guid>
		<description><![CDATA[If you intercept the form submit with some jQuery and find that you can&#8217;t trigger the submit yourself with your script, you may need to check the name of your submit button. If you have a submit button named submit, jQuery will not be able to submit that form. You may also see the error [...]]]></description>
			<content:encoded><![CDATA[<p>If you intercept the form submit with some jQuery and find that you can&#8217;t trigger the submit yourself with your script, you may need to check the name of your submit button. If you have a submit button named submit, jQuery will not be able to submit that form. You may also see the error &#8220;Uncaught TypeError: Property &#8216;submit&#8217; of object #<HTMLFormElement> is not a function&#8221;.</p>
<p>The fix is simple of course. Change the button name.</p>
<p>Wrong:
<pre class="brush: plain; title: ; notranslate">&lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;confirm&quot; value=&quot;Confirm&quot;&gt;</pre>
<p>Right:
<pre class="brush: plain; title: ; notranslate">&lt;input type=&quot;submit&quot; name=&quot;confirm&quot; id=&quot;confirm&quot; value=&quot;Confirm&quot;&gt;</pre>
<p>Hope that helps someone else.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bendauphinee.com/2012/05/never-forget-jquery-and-form-submit-breaking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shift The Graph</title>
		<link>http://blog.bendauphinee.com/2012/02/shift-the-graph/</link>
		<comments>http://blog.bendauphinee.com/2012/02/shift-the-graph/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 15:31:40 +0000</pubDate>
		<dc:creator>Ben Dauphinee</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[physical]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shift-register]]></category>

		<guid isPermaLink="false">http://blog.bendauphinee.com/?p=162</guid>
		<description><![CDATA[I have started working with an Arduino. For someone getting started in electronics, this device, and the community around it make it so much easier to learn. Within two minutes of plugging it in and starting the software, I was able to do something. Fast forward a bit, this project is the first big project [...]]]></description>
			<content:encoded><![CDATA[<p>I have started working with an Arduino. For someone getting started in electronics, this device, and the community around it make it so much easier to learn. Within two minutes of plugging it in and starting the software, I was able to do something.</p>
<p>Fast forward a bit, this project is the first big project I have taken on. It is a 10 segment bar graph that I wired up, but now, I am moving it&#8217;s control from the 10 analog pins to some shift registers. This frees up most of the pins that I needed initially, and doesn&#8217;t make control more difficult. </p>
<p>A shift register is like a bucket brigade. Each bucket is one bit on the register, and as you pass it bits, the rest of them get passed one down the line. So, to control which legs of the shift register are powered and which not, I just have to pulse 1&#8242;s and 0&#8242;s into the register until I get it set the way I want. Since the LED segments are controlled by the shift register legs, they&#8217;re set by what is pulsed to the register.</p>
<p>If I want to have an alternating pattern, the registers contain these values</p>
<pre class="brush: plain; title: ; notranslate">   [10101010] -&gt; [10101010]
// Register 1 -&gt; Register 2</pre>
<p>If I were to push one more bit down the line, they would all move one step along.</p>
<pre class="brush: plain; title: ; notranslate">   [01010101] -&gt; [01010101]
// Register 1 -&gt; Register 2</pre>
<p>If I wanted to push the segments to all lit, the register just has to be fed 1&#8242;s.</p>
<pre class="brush: plain; title: ; notranslate">   [11111111] -&gt; [11010101]
// Register 1 -&gt; Register 2</pre>
<p><br clear="both"><br />
<b>Part List</b></p>
<ul>
<li>Arduino</li>
<li>10 x 330&#8486; Resistors</li>
<li>10 Segment LED bar graph or 10 x LED&#8217;s</li>
<li>2 x 74LS164N Shift Registers (or any non-164 shift register, your wiring may be different)</li>
<li>Wires and Breadboards</li>
</ul>
<p><br clear="both"><br />
<b>Notes</b></p>
<ul>
<li>For this project, I&#8217;m not using the reset ability of the 164, so that pin has been tied to V+.</li>
<li>There is an Arduino function called shiftOut() that would make this a little easier. I have not used it because I wanted to shift the bits myself to get a better feel for what it was doing.</li>
<li>To wire the shift registers to the Arduino, it&#8217;s pin 2 on the Arduino to the clock pin (pin 8) on the first or second shift register (since they&#8217;re both wired together), and pin 3 Arduino to data pin (pin 1) on the first shift register.</li>
</ul>
<p><br clear="both"><br />
<a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/shiftregister.gif"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/shiftregister-150x150.gif" alt="" title="shiftregister" width="100" height="100" class="alignleft size-thumbnail wp-image-198 photo" style="float: left; border: 1px solid #000; margin: 2px;"/></a><a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/01.jpg"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/01-150x150.jpg" alt="" title="Bar Graph Wiring" width="100" height="100" class="size-thumbnail wp-image-168 photo" style="float: left; border: 1px solid #000; margin: 2px;" /></a><a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/02.jpg"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/02-150x150.jpg" alt="" title="Shift Register Wiring" width="100" height="100" class="size-thumbnail wp-image-169 photo" style="float: left; border: 1px solid #000; margin: 2px;" /></a><a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/03.jpg"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/03-150x150.jpg" alt="" title="Partially Connected Bar Graph" width="100" height="100" class="size-thumbnail wp-image-170 photo" style="float: left; border: 1px solid #000; margin: 2px;" /></a><a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/04.jpg"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/04-150x150.jpg" alt="" title="Bar Graph Wired To Shift Register" width="100" height="100" class="size-thumbnail wp-image-171 photo" style="float: left; border: 1px solid #000; margin: 2px;" /></a><a href="http://blog.bendauphinee.com/wp-content/uploads/2012/02/05.jpg"><img src="http://blog.bendauphinee.com/wp-content/uploads/2012/02/05-150x150.jpg" alt="" title="The Entire Setup Wired To Arduino" width="100" height="100" class="size-thumbnail wp-image-172 photo" style="float: left; border: 1px solid #000; margin: 2px;" /></a></p>
<p><br clear="both"></p>
<pre class="brush: plain; title: ; notranslate">
#define DATA 3
#define CLOCK 2

void setup() {
  pinMode(CLOCK, OUTPUT);
  pinMode(DATA, OUTPUT);

  for(int i = 0; i &lt; 10; ++i){
    digitalWrite(DATA, LOW);
    digitalWrite(CLOCK, HIGH);
    digitalWrite(CLOCK, LOW);
  }
}

void loop() {
  for(int i = 0; i &lt; 10; ++i){
    int hilo = random(0, 2);

    switch(hilo){
        case 0: digitalWrite(DATA, LOW); break;
        case 1: digitalWrite(DATA, HIGH); break;
    }

    digitalWrite(CLOCK, HIGH);
    digitalWrite(CLOCK, LOW);
    delay(50);
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.bendauphinee.com/2012/02/shift-the-graph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Heatmap Gradient Color Generator</title>
		<link>http://blog.bendauphinee.com/2011/12/php-heatmap-gradient-color-generator/</link>
		<comments>http://blog.bendauphinee.com/2011/12/php-heatmap-gradient-color-generator/#comments</comments>
		<pubDate>Mon, 26 Dec 2011 02:57:57 +0000</pubDate>
		<dc:creator>Ben Dauphinee</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gradient]]></category>
		<category><![CDATA[heatmap]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.bendauphinee.com/?p=137</guid>
		<description><![CDATA[Based on the awesome work done here Samson PHP Color Gradient Generator, I have packed up his code into two functions that are by default set to generate heatmap blue to red color gradients, in as many steps as you need.]]></description>
			<content:encoded><![CDATA[<p>Based on the awesome work done here <a href="http://www.herethere.net/~samson/php/color_gradient/" title="Samson PHP Color Gradient Generator" target="_blank">Samson PHP Color Gradient Generator</a>, I have packed up his code into two functions that are by default set to generate heatmap blue to red color gradients, in as many steps as you need.</p>
<pre class="brush: php; title: ; notranslate">function heatSteps($config){
    $config['colorStart'] = (isset($config['colorStart'])) ? hexdec($config['colorStart']) : 0xdee7f8;
    $config['colorEnd'] = (isset($config['colorEnd'])) ? hexdec($config['colorEnd']) : 0xff0f15;
    $config['colorSteps'] = (isset($config['colorSteps'])) ? $config['colorSteps'] : 10;

    $config['colorStart'] = (($config['colorStart'] &gt;= 0x000000) &amp;&amp; ($config['colorStart'] &lt;= 0xffffff)) ? $config['colorStart'] : 0x000000;
    $config['colorEnd'] = (($config['colorEnd'] &gt;= 0x000000) &amp;&amp; ($config['colorEnd'] &lt;= 0xffffff)) ? $config['colorEnd'] : 0xffffff;
    $config['colorSteps'] = (($config['colorSteps'] &gt; 0) &amp;&amp; ($config['colorSteps'] &lt; 256)) ? $config['colorSteps'] : 256;

    $theR0 = ($config['colorStart'] &amp; 0xff0000) &gt;&gt; 16;
    $theG0 = ($config['colorStart'] &amp; 0x00ff00) &gt;&gt; 8;
    $theB0 = ($config['colorStart'] &amp; 0x0000ff) &gt;&gt; 0;

    $theR1 = ($config['colorEnd'] &amp; 0xff0000) &gt;&gt; 16;
    $theG1 = ($config['colorEnd'] &amp; 0x00ff00) &gt;&gt; 8;
    $theB1 = ($config['colorEnd'] &amp; 0x0000ff) &gt;&gt; 0;

    $colorSteps = array();
    for($i = 0; $i &lt;= $config['colorSteps']; $i++){
        $theR = interpolateHeatSteps($theR0, $theR1, $i, $config['colorSteps']);
        $theG = interpolateHeatSteps($theG0, $theG1, $i, $config['colorSteps']);
        $theB = interpolateHeatSteps($theB0, $theB1, $i, $config['colorSteps']);

        $colorSteps[] = dechex(((($theR &lt;&lt; 8) | $theG) &lt;&lt; 8) | $theB);
    }

    return($colorSteps);
}

function interpolateHeatSteps($pBegin, $pEnd, $pStep, $pMax){
    if ($pBegin &lt; $pEnd){
        return(($pEnd - $pBegin) * ($pStep / $pMax)) + $pBegin;
    }else{
        return(($pBegin - $pEnd) * (1 - ($pStep / $pMax))) + $pEnd;
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.bendauphinee.com/2011/12/php-heatmap-gradient-color-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

