<?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>Jacob Pierce &#187; Arduino</title>
	<atom:link href="http://www.jacobpierce.com/blog/category/technology/arduino/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jacobpierce.com/blog</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 04:51:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Arduino: Hello World&#8230; a first sketch, with 384 LEDs</title>
		<link>http://www.jacobpierce.com/blog/2009/10/11/arduino-hello-world-with-384-leds/</link>
		<comments>http://www.jacobpierce.com/blog/2009/10/11/arduino-hello-world-with-384-leds/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 03:58:31 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[How-To]]></category>

		<guid isPermaLink="false">http://www.jacobpierce.com/blog/?p=47</guid>
		<description><![CDATA[I picked up an Arduino recently after about two years of lusting for one &#8212; just never had time. The standard first program sketch is a blinking LED (see this great Make Magazine video), but the same time I ordered the Arduino I also bought a $10 (shipped from China) 24&#215;16 LED Matrix from Sure ]]></description>
			<content:encoded><![CDATA[<p>I picked up an <a href="http://www.arduino.cc" target="_blank">Arduino</a> recently after about two years of lusting for one &#8212; just never had time. The standard first program sketch is a blinking LED (see this great <a title="make" href="http://www.youtube.com/watch?v=pMV2isNm8JU" target="_blank">Make Magazine video</a>), but the same time I ordered the Arduino I also bought a $10 (shipped from China) <a href="http://www.sureelectronics.net/goods.php?id=142" target="_blank">24&#215;16 LED Matrix</a> from <a href="http://www.sure-electronics.com/">Sure Electronics</a> on eBay. So since more is better, of course I want to make all <em>384</em> <em>LEDs</em> blink (at random).</p>
<p>Let&#8217;s hook it up!</p>
<div id="attachment_49" class="wp-caption aligncenter" style="width: 417px"><a href="http://www.jacobpierce.com/blog/wp-content/uploads/2009/10/24x16_led_matrix_wiring.gif"><img class="size-full wp-image-49" title="24x16 LED Matrix Wiring" src="http://www.jacobpierce.com/blog/wp-content/uploads/2009/10/24x16_led_matrix_wiring.gif" alt="24x16 LED Matrix Wiring (Fritzing)" width="407" height="525" /></a><p class="wp-caption-text">24x16 LED Matrix Wiring (made using Fritzing)</p></div>
<p><span id="more-47"></span></p>
<p>If you reverse the GND and 5V wiring you will probably blow up the display. The pin numbers are on the back of the display, so be sure to reference those. The connections:</p>
<p>- Arduino Digital <strong>Output 12</strong> to <strong>pin 1</strong> of the display connector (CS).<br />
- Digital <strong>Output 11</strong> goes to <strong>pin 5</strong> of the display (WRCLK)<br />
- Digital <strong>Output 10</strong> goes to <strong>pin 7</strong> of the display (DATA)<br />
- Digital <strong>GND</strong> goes to <strong>pin 11</strong> of the display (GND)<br />
- Power <strong>5v</strong> goes to <strong>pin 12</strong> of the display (+5V)</p>
<p><a href="http://www.jacobpierce.com/blog/wp-content/uploads/2009/10/arudino_ledmatrix.jpg"><img class="aligncenter size-full wp-image-52" title="arudino_ledmatrix" src="http://www.jacobpierce.com/blog/wp-content/uploads/2009/10/arudino_ledmatrix.jpg" alt="arudino_ledmatrix" width="450" height="284" /></a></p>
<p>Now to the <strong>software</strong>. I found a post by westfw (<a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439/90" target="_blank">#94</a>) on Arduino.cc with some sample code that goes through a variety of demos on the display using various contributors&#8217; code. I&#8217;m a novice programmer at best, but I took his demo and cut out just the core parts for the display and wrote my own implementation to have the whole matrix select and toggle random LEDs on and off. <a href="http://www.jacobpierce.com/blog/wp-content/uploads/2009/10/blinker24x16.zip">Download the whole thing here.</a> It&#8217;s not pretty, but here&#8217;s my hasty code:</p>
<blockquote><p>void setup ()<br />
{<br />
ht1632_setup();<br />
randomSeed(analogRead(0)); //get some analog static from pin 0 for the random number generator<br />
}</p>
<p>void loop ()<br />
{<br />
int x, y, p;</p>
<p>x=random(24);            //pick a random X coordinate<br />
y=random(16);            //pick a random Y coordinate<br />
p=random(2);             //pick on/off (1 or 0, respectively)</p>
<p>plot(x,y,p);             //tell the display to execute the randomness</p>
<p>}</p></blockquote>
<p>So if you&#8217;re vaguely familiar with Arudino (like me at this point) you should be able to plug wires in, run the code, and watch some LEDs blink randomly. Behold the awesome power of microcontrollers!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7058472&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="300" src="http://vimeo.com/moogaloop.swf?clip_id=7058472&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><em>Related links:</em></p>
<p>- <a href="http://www.sureelectronics.net/pdfs/DE-DP016.pdf">Sure Electronics DE-DP016 Data Sheet</a><br />
- <a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439/0">Arduino.cc Forum Post on the DE-DP016</a> (and related displays)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jacobpierce.com/blog/2009/10/11/arduino-hello-world-with-384-leds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
