<?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>Richard Lee&#039;s Blog</title>
	<atom:link href="http://rl337.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://rl337.org</link>
	<description>Where I let the crazy out</description>
	<lastBuildDate>Tue, 08 May 2012 16:45:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Arduino Control from Web via WiFly</title>
		<link>http://rl337.org/2012/05/08/arduino-control-from-web-via-wifly/</link>
		<comments>http://rl337.org/2012/05/08/arduino-control-from-web-via-wifly/#comments</comments>
		<pubDate>Tue, 08 May 2012 16:45:38 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=412</guid>
		<description><![CDATA[I bought a WiFly a while back but didn&#8217;t really do much with it.  For those of you not in the know, a WiFly is a compact wireless device that you can buy on a little break-out board&#8230; or in &#8230; <a href="http://rl337.org/2012/05/08/arduino-control-from-web-via-wifly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/05/IMG_0691.jpg"><img class="alignright size-medium wp-image-413" title="IMG_0691" src="http://rl337.org/wp-content/uploads/2012/05/IMG_0691-300x224.jpg" alt="" width="300" height="224" /></a>I bought a <a title="WyFly Shield off to a rough start" href="http://rl337.org/2012/03/29/wifly-shield-off-to-a-rough-start/">WiFly a while back</a> but didn&#8217;t really do much with it.  For those of you not in the know, a <a href="http://www.sparkfun.com/products/9367">WiFly</a> is a compact wireless device that you can buy on a little break-out board&#8230; or in this case, on an <a href="http://arduino.cc/en/Main/ArduinoShields">Arduino Shield</a>.</p>
<p>The interface to the WiFly is pretty straight forward.  You initialize the library then create a Client object.  This Client object has typical filehandle-like methods such as read(), available(), println() etc.</p>
<p>In this example, I took my <a title="Monkeying with 8-bit Latches" href="http://rl337.org/2012/05/02/monkeying-with-8-bit-latches/">previous setup with 8-bit latches</a> and used the LEDs to display output that I submitted to a webservice using the WiFly.  The Webservice in question is a very simple php app that returns a single 8-bit hex number.  Here&#8217;s the code:</p>
<pre>&lt;?php print '@'.dechex(time() % 255); ?&gt;</pre>
<p>The prepended &#8216;@&#8217; sign is a flag value.  Because read() returns just a single char, I wanted to skip through all of the http header information to the data.  I stop when I encounter the first &#8216;@&#8217;.</p>
<p>I modified the latch setup I had by using two triplets of pins instead of sharing the single triple.  This allowed me to independently control two latches. Here&#8217;s the final code for the project:</p>
<pre>#include "WiFly.h"

int latchPin1 = 2;
int clockPin1 = 3;
int dataPin1 = 4;

int latchPin2 = 5;
int clockPin2 = 6;
int dataPin2 = 7;

Client client("www.tokyo3.com", 80);

void setup() {
  Serial.begin(9600);
  pinMode(latchPin1, OUTPUT);
  pinMode(clockPin1, OUTPUT);
  pinMode(dataPin1, OUTPUT);

  pinMode(latchPin2, OUTPUT);
  pinMode(clockPin2, OUTPUT);
  pinMode(dataPin2, OUTPUT);

  WiFly.begin();

  if (!WiFly.join("ssid", "password")) {
    Serial.println("Association failed.");
    while (1) {
      // Hang on failure.
    }
  }
}

int convert(char ch) {
    if (ch &gt;= '0' &amp;&amp; ch &lt;= '9') {
         return ch - '0';
    }
    if (ch &gt;= 'a' &amp;&amp; ch &lt;= 'f') {
         return ch - 'a' + 10;
    }
    return 0;   
}

int getWebValue() {
  if (!client.connected()) {
      Serial.println("Connecting...");
      if (!client.connect()) {
        return 0;
      }
  }

  client.println("GET /arduino.php HTTP/1.1");
  client.println("Host: www.tokyo3.com");
  client.println();  

  char ch;
  while (client.available()) {
    ch = client.read();
    Serial.print(ch);
    if (ch == '@') {
      break;
    }
  }

  if (!client.available()) {
     return 0;
  }

  int a = convert(client.read());
  int b = convert(client.read());

  return (a &lt;&lt; 4) + b;
}

int count = 0;
void loop() {
    int a = getWebValue();

    if (count++ % 2 == 0) {
        digitalWrite(latchPin1, LOW);
        shiftOut(dataPin1, clockPin1, MSBFIRST, a);  
        digitalWrite(latchPin1, HIGH);
    } else {
        digitalWrite(latchPin2, LOW);
        shiftOut(dataPin2, clockPin2, MSBFIRST, a);  
        digitalWrite(latchPin2, HIGH);
    }
    delay(1000);
}</pre>
<p>Pretty simple for the most part.  As with the WiFly examples, I use the Serial Monitor to echo print.  Very useful when trying to figure out what you&#8217;re getting via network.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/05/08/arduino-control-from-web-via-wifly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Terrain Tiles</title>
		<link>http://rl337.org/2012/05/03/terrain-tiles/</link>
		<comments>http://rl337.org/2012/05/03/terrain-tiles/#comments</comments>
		<pubDate>Thu, 03 May 2012 16:46:48 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=408</guid>
		<description><![CDATA[The challenge here is, What is the minimal set of terrain tile types to be able to build arbitrary terrain in a side scroller?  In theory, you don&#8217;t need minimal sets of anything if your blocks fit exactly into a &#8230; <a href="http://rl337.org/2012/05/03/terrain-tiles/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/05/terrain.png"><img class=" wp-image-409 alignnone" title="terrain" src="http://rl337.org/wp-content/uploads/2012/05/terrain.png" alt="" width="611" height="303" /></a></p>
<p>The challenge here is, What is the minimal set of terrain tile types to be able to build arbitrary terrain in a <a href="http://en.wikipedia.org/wiki/Side-scrolling_video_game">side scroller</a>?  In theory, you don&#8217;t need minimal sets of anything if your blocks fit exactly into a square.  You see that all over; especially in the older <a href="http://en.wikipedia.org/wiki/Nintendo_Entertainment_System">Nintendo</a> classics.  I want to be able to use a more diverse set of borders though&#8230; and I *think* the above image represents a complete set.</p>
<p>That&#8217;s not to say that each type of tile won&#8217;t have many distinct <a href="http://en.wikipedia.org/wiki/Tile-based_video_game">tilesets</a>&#8230; Hopefully I will have quite a few distinct tilesets for this game.</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/05/03/terrain-tiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monkeying with 8-bit Latches</title>
		<link>http://rl337.org/2012/05/02/monkeying-with-8-bit-latches/</link>
		<comments>http://rl337.org/2012/05/02/monkeying-with-8-bit-latches/#comments</comments>
		<pubDate>Wed, 02 May 2012 05:04:15 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=405</guid>
		<description><![CDATA[I while back, I bought a couple of 8-bit Latches which I had intended to conquer the world with&#8230; but just never got around to it. As I&#8217;ve just found out&#8230; these specifically may not be the right model for &#8230; <a href="http://rl337.org/2012/05/02/monkeying-with-8-bit-latches/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I while back, I bought a couple of <a href="https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&amp;productId=911189&amp;langId=-1&amp;catalogId=10001&amp;krypto=kMYYrBxGZ%2FJcfaX9kvnXQccS%2BP4zc75V%2FP8SOwNmJCk%3D&amp;ddkey=https:CookieLogon">8-bit Latches</a> which I had intended to conquer the world with&#8230; but just never got around to it. As I&#8217;ve just found out&#8230; these specifically may not be the right model for that purpose. sigh.  Let me expound&#8230;</p>
<p><a href="http://rl337.org/wp-content/uploads/2012/05/IMG_0683.jpg"><img class="alignleft size-medium wp-image-406" title="IMG_0683" src="http://rl337.org/wp-content/uploads/2012/05/IMG_0683-300x224.jpg" alt="" width="300" height="224" /></a>As I&#8217;ve explored in previous <a title="Chaining Demultiplexers" href="http://rl337.org/2012/04/04/chaining-demultiplexers/">Arduino setups</a>, I want to control lots of things with few output pins.  With this specific setup, I was hoping to populate two different 8-pin latches using a large number of shared pins like with the LCD project&#8230; but alas, these latches don&#8217;t really like sharing their pins&#8230;</p>
<p>If I share pins between the latches (clock/latch pins) but have a selectable data pin, the unselected latch still *thinks* I&#8217;m talking to it&#8230; What I need is a latch with an Enable Pin.</p>
<p>Pictured above, I was just testing to verify that both latches actually worked. Both are connected to the same outputs, so their values are mirrored. I won&#8217;t post any code this time because I used the <a href="http://arduino.cc/en/Tutorial/ShiftOut">ShiftOut</a> example verbatim.</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/05/02/monkeying-with-8-bit-latches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building for Windows!</title>
		<link>http://rl337.org/2012/04/25/building-for-windows/</link>
		<comments>http://rl337.org/2012/04/25/building-for-windows/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 08:39:39 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=397</guid>
		<description><![CDATA[It took me a while to get there, but I&#8217;ve finally gotten a Windows build of the Weirdo in a Weird Land bootstrap project! My first attempt at building one involved grabbing Visual Studio 10 Express but it really wasn&#8217;t &#8230; <a href="http://rl337.org/2012/04/25/building-for-windows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_399" class="wp-caption alignright" style="width: 249px"><a href="http://rl337.org/wp-content/uploads/2012/04/wiawl-dist.zip"><img class="size-full wp-image-399 " title="Download Windows Version!" src="http://rl337.org/wp-content/uploads/2012/04/windows-logo.jpg" alt="" width="239" height="211" /></a><p class="wp-caption-text">Download the Windows Version!</p></div>
<p>It took me a while to get there, but I&#8217;ve finally gotten a Windows build of the <a title="Weirdo in a Weird Land" href="http://rl337.org/2012/04/17/weirdo-in-a-weird-land/">Weirdo in a Weird Land</a> bootstrap project!</p>
<p>My first attempt at building one involved grabbing <a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/express">Visual Studio 10 Express</a> but it really wasn&#8217;t meant to be used from the command line&#8230; at least not easily&#8230;</p>
<p>The successful strategy was to use the <a href="http://www.mingw.org/">Minimalist GNU for Windows</a> toolchain.  This lead to some heartache which began with linker issues&#8230; but working with the <a href="http://wiki.libsdl.org/moin.cgi/FAQWindows">SDL FAQ</a>, I got things mostly working.  Of all the problems, the most surprising to me was the fact that including libraries in gcc is significant.  Specifically&#8230; the following did not work:</p>
<pre>$(CC) -o $(BUILDDIR)/$(EXETARGET) $(BUILDDIR)/main.o \
    $(BUILDDIR)/Level.o $(BUILDDIR)/SDLAppMain.o \
    -L$(SDLDIR)/lib -L$(SDLIMAGEDIR)/lib/$(ARCH) \
    -lSDLmain -lSDL -lSDL_image -lmingw32 -mwindows</pre>
<p>but THIS did!</p>
<pre>$(CC) -o $(BUILDDIR)/$(EXETARGET) $(BUILDDIR)/main.o \
    $(BUILDDIR)/Level.o $(BUILDDIR)/SDLAppMain.o \
    -L$(SDLDIR)/lib -L$(SDLIMAGEDIR)/lib/$(ARCH) \
    -lmingw32 -lSDLmain -lSDL -lSDL_image -mwindows</pre>
<p>The significant part here is the -lmingw32 being first.  Without that, I got the following linker issue&#8230;</p>
<pre id="I_get_.22Undefined_reference_to_.27WinMain.4016.27.22">Undefined reference to 'WinMain@16'</pre>
<p>Which is discussed in the FAQ&#8230; but the answer did not point out that the ordering of the libraries was significant!</p>
<p>Now i just need to create a proper Makefile that will switch easily between the two architectures&#8230;. then it&#8217;s time to actually write the game!</p>
<p>UPDATE: The original zip that I uploaded seemed to be missing a few necessary files&#8230; specifically two DLLs: libgcc_s_dw2-1.dll and libstdc++-6.dll both of which are now part of the distribution.</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/04/25/building-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weirdo in a Weird Land</title>
		<link>http://rl337.org/2012/04/17/weirdo-in-a-weird-land/</link>
		<comments>http://rl337.org/2012/04/17/weirdo-in-a-weird-land/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 16:46:34 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=390</guid>
		<description><![CDATA[Weirdo in a Weird Land is the working title for the slowly progressing game. It took a while to actually get the application bundle squared away. One of the more irritating parts of creating the bundle was referencing the image &#8230; <a href="http://rl337.org/2012/04/17/weirdo-in-a-weird-land/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Weirdo in a Weird Land is the working title for the slowly <a title="SDL side scroller takes shape" href="http://rl337.org/2012/04/10/sdl-side-scroller-takes-shape/">progressing game.</a></p>
<p>It took a while to actually get the application bundle squared away.</p>
<div id="attachment_393" class="wp-caption alignright" style="width: 138px"><a href="http://rl337.org/wp-content/uploads/2012/04/wiawl.zip"><img class="size-full wp-image-393" title="First OSX Build" src="http://rl337.org/wp-content/uploads/2012/04/wiawl-128.png" alt="" width="128" height="128" /></a><p class="wp-caption-text">Click Image to Download v0.0.1!</p></div>
<p>One of the more irritating parts of creating the bundle was referencing the image resources.  Mac Applications are supposed to keep their data in a <span style="color: #ff6600;">Contents/Resources</span> but using the provided SDLMain, your application&#8217;s working directory is the PARENT of the resource bundle&#8230; so you&#8217;d have to make the assumption that the end user didn&#8217;t rename the application bundle on you and build your path including what you think your resource bundle is named.</p>
<p>I modified the SDLMain a little bit, putting the working directory at the top level of the Application Bundle.  This allows me to reference my image files as: Contents/Resources/Images/ which is still a little ugly, but probably more reliable.  The &#8220;correct&#8221; thing to do would be to have SDLMain expose a method which allows me to retrieve the path of individual resources.  That&#8217;s probably a much later change though.</p>
<p>My most recent efforts are to get a Windows build going.  I&#8217;d like to do the up front work to make this game cross platform.  This way, I can release builds for both Mac and PC/Win32 relatively easily in the future.  My first attempt at creating a Win32 build was using Visual Studio 2010 Express, but I ran into a lot of strange linking issues.  The compilation process was tough too.  <a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B">cl.exe</a> command line compiler had radically different invocations than <a href="http://en.wikipedia.org/wiki/GNU_Compiler_Collection">gcc</a>&#8230; so it&#8217;s unlikely that I&#8217;d be able to reuse the same Makefile. There has to be an easier way to build a windows app than this&#8230;</p>
<p>The <a href="http://libsdl.org">SDL</a> Tutorial suggests using <a href="http://www.mingw.org/">mingw32</a> which is a minimalist windows <a href="http://en.wikipedia.org/wiki/Toolchain">toolchain</a> built on top of all GNU tools.  This means that I *SHOULD* be able to reuse my Makefile and if it&#8217;s part of the tutorial&#8230; I shouldn&#8217;t run into weird issues.  We&#8217;ll see how that pans out.  Hopefully by Thursday I&#8217;ll have a slightly expanded build that runs on both <a href="http://windows.microsoft.com/en-US/windows/home">Windows</a> and <a href="http://www.apple.com/macosx/">OSX</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/04/17/weirdo-in-a-weird-land/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SDL side scroller takes shape</title>
		<link>http://rl337.org/2012/04/10/sdl-side-scroller-takes-shape/</link>
		<comments>http://rl337.org/2012/04/10/sdl-side-scroller-takes-shape/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 16:32:43 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=387</guid>
		<description><![CDATA[ In my previous post on SDL, I talked a little bit about layering bitmaps to create a simple side scroller. Here, I&#8217;ve actually gotten bitmap layering to work.  I&#8217;ve used the rough bitmaps that I drew for the last blog &#8230; <a href="http://rl337.org/2012/04/10/sdl-side-scroller-takes-shape/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"> In my <a title="Layers of Detail with Blitting in SDL" href="http://rl337.org/2012/03/13/layers-of-detail-with-blitting-in-sdl/">previous post</a> on <a href="http://libsdl.org">SDL</a>, I talked a little bit about layering bitmaps to create a simple <a href="http://en.wikipedia.org/wiki/Side-scrolling_video_game">side scroller</a>.</p>
<p style="text-align: left;">Here, I&#8217;ve actually gotten bitmap layering to work.  I&#8217;ve used the rough bitmaps that I drew for the last blog post and built some code around it.   I haven&#8217;t gotten to the point where I can built a distributable binary yet, but I&#8217;m hoping that it won&#8217;t be too tough.  I&#8217;m hoping to NOT have to involve <a href="https://developer.apple.com/xcode/">xcode</a>&#8230; but all literature I&#8217;ve found on building apple distributables seem to center around that tool.</p>
<p style="text-align: left;">Here&#8217;s a screenshot of the resulting app.  Doesn&#8217;t look very different from my mockup&#8230; but that&#8217;s probably a good thing.</p>
<p style="text-align: left;"><a href="http://rl337.org/wp-content/uploads/2012/04/sdlfun-screenshot.png"><img class=" wp-image-388 aligncenter" title="sdlfun-screenshot" src="http://rl337.org/wp-content/uploads/2012/04/sdlfun-screenshot.png" alt="" width="640" height="502" /></a>The way this ended up being implemented was through a Level class.  The Level class has an array of Layers and a current position (x axis).  Each layer has a coefficient that describes its motion relative to the Level&#8217;s x position. Foreground objects have a coefficient of &gt; 1 and objects further in the background have coefficients less than one.</p>
<p style="text-align: left;">Each Layer has an array of LayerObjects. Each LayerObject which includes a bitmap and a coordinate. They&#8217;re arranged in the Array in increasing order of x.</p>
<p style="text-align: left;">I captured the SDLK_LEFT and SDLK_RIGHT key events.  When SDLK_RIGHT is pushed, I&#8217;d increment the level&#8217;s x position until the key was released.  Similarly for the SDLK_LEFT button except the position is decremented.</p>
<p style="text-align: center;">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/04/10/sdl-side-scroller-takes-shape/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chaining Demultiplexers</title>
		<link>http://rl337.org/2012/04/04/chaining-demultiplexers/</link>
		<comments>http://rl337.org/2012/04/04/chaining-demultiplexers/#comments</comments>
		<pubDate>Wed, 04 Apr 2012 14:44:15 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Arduino]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=384</guid>
		<description><![CDATA[Before, I controlled 6 LEDs with 3 pins.  This fit very neatly onto a single 3-8 Demultiplexer.  For me to achieve my goals of world domination, I need to be able to chain them. What exactly do I mean by &#8230; <a href="http://rl337.org/2012/04/04/chaining-demultiplexers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/04/IMG_0657.jpg"><img class="alignleft size-medium wp-image-385" title="IMG_0657" src="http://rl337.org/wp-content/uploads/2012/04/IMG_0657-300x224.jpg" alt="" width="300" height="224" /></a>Before, I controlled 6 LEDs with 3 pins.  This fit very neatly onto a single 3-8 Demultiplexer.  For me to achieve my goals of world domination, I need to be able to chain them.</p>
<p>What exactly do I mean by chaining?  Well, by themselves, a 3-8 demultiplexer can control 8 things with 3 control pins.  It follows, that to control 16 things, we need 2 demultiplexers and 6 control pins.  Well, by chaining, you can control 16 things with just 4 pins!  Well, how does this work?</p>
<p>Well, you take the regular 3 control pins and connect them to BOTH multiplexer input pins. The 4th &#8220;input&#8221; pin actually just switches between which demultiplexer we&#8217;re using.  So it connects to the &#8220;G1&#8243; of the second and one of the G2s on the first.</p>
<p>I couldn&#8217;t really do this before because I lacked the space on my previous little breadboard.  In case you hadn&#8217;t noticed&#8230; I&#8217;ve upgraded!</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/04/04/chaining-demultiplexers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WyFly Shield off to a rough start</title>
		<link>http://rl337.org/2012/03/29/wifly-shield-off-to-a-rough-start/</link>
		<comments>http://rl337.org/2012/03/29/wifly-shield-off-to-a-rough-start/#comments</comments>
		<pubDate>Thu, 29 Mar 2012 16:41:38 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=378</guid>
		<description><![CDATA[Here you see my new WyFly shield!  This little guy will one day bring Wifi capabilities to my Arduino&#8230; but not yet&#8230; not yet. Thankfully there isn&#8217;t a lot of assembly required for the shield.  All you have to do &#8230; <a href="http://rl337.org/2012/03/29/wifly-shield-off-to-a-rough-start/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/03/IMG_0652.jpg"><img class="alignleft size-medium wp-image-379" title="IMG_0652" src="http://rl337.org/wp-content/uploads/2012/03/IMG_0652-300x224.jpg" alt="" width="300" height="224" /></a>Here you see my new <a href="http://www.sparkfun.com/products/9367">WyFly</a> shield!  This little guy will one day bring <a href="http://en.wikipedia.org/wiki/Wifi">Wifi</a> capabilities to my <a href="http://arduino.cc/en/Main/ArduinoBoardUno">Arduino</a>&#8230; but not yet&#8230; not yet.</p>
<p>Thankfully there isn&#8217;t a lot of assembly required for the shield.  All you have to do is solder in the <a href="http://www.sparkfun.com/products/9279">headers</a>&#8230; which is easy enough&#8230; even for me! (see the <a href="https://plus.google.com/u/1/111497547501522705099/posts/RJS78jywK5u">evidence</a>)</p>
<p>Out of the box, the <a href="http://forum.sparkfun.com/viewtopic.php?f=32&amp;t=25216">libaries</a> didn&#8217;t seem to want to work.  First there&#8217;s the &#8220;no such WProgram.h&#8221; issue which is easy enough to solve&#8230; you change the #include to &#8220;Arduino.h&#8221;.. but then there were some strange Arduino API changes with the Print object.  Nothing was terribly wrong&#8230; the write() methods now returned a size_t when before they were void.</p>
<p>Compilation out of the way&#8230; I uploaded an example&#8230; and nothing happened. I was supposed to see a google search result for &#8220;Arduino&#8221; scroll past on the Serial Monitor&#8230; but nothing.  Looks like more digging for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/03/29/wifly-shield-off-to-a-rough-start/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Controlling multiple LCDs from one Arduino</title>
		<link>http://rl337.org/2012/03/20/controlling-multiple-lcds-from-one-arduino/</link>
		<comments>http://rl337.org/2012/03/20/controlling-multiple-lcds-from-one-arduino/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 05:13:13 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[demultiplexer]]></category>
		<category><![CDATA[hexinverter]]></category>
		<category><![CDATA[lcd]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=371</guid>
		<description><![CDATA[Taking the previous Arduino project a step further, I managed to get two LCDs independently updating from a single Arduino.  My original plan was to have 4 of them updating independently, but two of the cables that I made for &#8230; <a href="http://rl337.org/2012/03/20/controlling-multiple-lcds-from-one-arduino/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/03/IMG_0641.jpg"><img class="alignleft size-medium wp-image-372" title="IMG_0641" src="http://rl337.org/wp-content/uploads/2012/03/IMG_0641-300x224.jpg" alt="" width="300" height="224" /></a>Taking the <a title="Controlling 6 LEDs with only 3 pins" href="http://rl337.org/2012/03/06/controlling-6-leds-with-only-3-pins/">previous Arduino project</a> a step further, I managed to get two <a href="https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_2115469_-1">LCDs </a>independently updating from a single Arduino.  My original plan was to have 4 of them updating independently, but two of the cables that I made for connecting the LCDs to my <a href="http://en.wikipedia.org/wiki/Breadboard">breadboard</a> somehow stopped working.  I suspect that <a href="https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_153948_-1">14-pin header</a> stopped making contact with one or more of its pins.</p>
<p><a href="http://rl337.org/wp-content/uploads/2012/03/IMG_0644.jpg"><img class="alignright size-medium wp-image-373" title="IMG_0644" src="http://rl337.org/wp-content/uploads/2012/03/IMG_0644-224x300.jpg" alt="" width="224" height="300" /></a>You can see in the image to the right, how I constructed this cable.  It&#8217;s essentially a <a href="https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_644156_-1">ribbon cable</a> that I cut down 14-pins wide.  On one end I connected the <a href="https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_153948_-1">14-pin header</a> and at the other, I connected a series of <a href="https://www.jameco.com/webapp/wcs/stores/servlet/StoreCatalogDrillDownView?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;categoryName=cat_3040&amp;subCategoryName=Interconnects%20%2F%20Rectangular%20Connectors%20%2F%20Discrete%20Wire%20Housing&amp;category=304090&amp;refine=1&amp;position=1&amp;history=8vfb1qat%7CsubCategoryName~Interconnects%5Ecategory~30%5EcategoryName~category_root%5EprodPage~15%5Epage~SEARCH%252BNAV%402ljbuj6b%7Ccategory~3040%5EcategoryName~cat_30%5Eposition~1%5Erefine~1%5EsubCategoryName~Interconnects%2B%252F%2BRectangular%2BConnectors%5EprodPage~15%5Epage~SEARCH%252BNAV%40zabjogsc%7CrefineValue~MOLEX%2BINC.%5ErefineType~1%5Eposition~1%5Esub_attr_name~Manufacturer%5Erefine~1%5EprodPage~15%5Epage~SEARCH%252BNAV">Molex connectors</a>.  I chose the to break the wire into three groups of four pins plus a single group of two.  The group of two corresponds to the Power and Ground of the LCD.  The first group of 4 has the LCD&#8217;s RW, RS, Enable, and Contrast pins.  The final two groups of four end up being the data pins. (In four pin mode, only the second group of data pins are used).</p>
<p><a href="http://rl337.org/wp-content/uploads/2012/03/IMG_0640.jpg"><img class="alignleft size-medium wp-image-374" title="IMG_0640" src="http://rl337.org/wp-content/uploads/2012/03/IMG_0640-300x224.jpg" alt="" width="300" height="224" /></a></p>
<p>If you look at the assembly from above, you can see that on the larger breadboard, I have a similar setup to my <a title="Controlling 6 LEDs with only 3 pins" href="http://rl337.org/2012/03/06/controlling-6-leds-with-only-3-pins/">previous project&#8217;s setup</a>.  Essentially, I have a <a href="http://en.wikipedia.org/wiki/Demultiplexer">3-8 Demultiplexer</a> and a <a href="http://en.wikipedia.org/wiki/Inverter_%28logic_gate%29">Hex inverter</a>.  The input to the Demultiplexer comes from the digital out pins from the Arduino and the outputs run through inverters.  I connect the inverted values to the &#8220;G1&#8243; of the LCD which, when set to LOW disables writing to the LCD.  Since I know that the inverted output of the demuxer will only ever have a single line set HIGH, I can use it to select which LCD to enable.  The other LCD pins are all connected in parallel to the controlling pins on the Arduino.</p>
<pre>#include &lt;LiquidCrystal.h&gt;

LiquidCrystal lcd(11, 9, 5, 4, 3, 2);
int state;

void setup() {
  pinMode(12, OUTPUT);
  pinMode(10, OUTPUT);

  // Pin 6 controls which LCD. If I had more than
  // two LCDs, I would need more pins to select them
  pinMode(6, OUTPUT); 

  state = 0; // Pin 6's value 0 -&gt; LOW, 1 -&gt; HIGH

  // Initialize the first LCD
  digitalWrite(6, LOW);
  lcd.begin(20, 2);
  lcd.print("I am Tweedle Dee!");

  // Select and initialize the 2nd LCD
  digitalWrite(6, HIGH);
  lcd.begin(20, 2);
  lcd.print("I am Tweedle Dum!");
}

void loop() {
  digitalWrite(6, state == 0 ? LOW : HIGH);
  lcd.setCursor(0, 1);
  lcd.print(millis()/1000);
  delay(1000);

  state = 1 - state; // toggle which LCD to display on
}</pre>
<p>The program itself was based heavily on the LCD Hello World example.  I changed a couple of pins around to be more convenient for my wiring&#8230; but the loop() function was copied almost verbatim.  The intent of the program was to have one LCD display &#8220;I am Tweedle Dee!&#8221; and the other to display &#8220;I am Tweedle Dum!&#8221; then Tweedle Dee will start counting all even numbers while Tweedle Dum counts all odd numbers.  As you can see here&#8230; it worked out fairly well!</p>
<p><a href="http://rl337.org/wp-content/uploads/2012/03/IMG_0643.jpg"><img class="aligncenter size-large wp-image-375" title="IMG_0643" src="http://rl337.org/wp-content/uploads/2012/03/IMG_0643-1024x764.jpg" alt="" width="584" height="435" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/03/20/controlling-multiple-lcds-from-one-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PGM Class and Octave</title>
		<link>http://rl337.org/2012/03/15/pgm-class-and-octave/</link>
		<comments>http://rl337.org/2012/03/15/pgm-class-and-octave/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 15:30:42 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://rl337.org/?p=366</guid>
		<description><![CDATA[About a month and a half ago, I signed up for an on-line class called Probabilistic Graphical Models in an attempt to learn a bit more about some of the math that we use at Topsy Labs. The strange logo &#8230; <a href="http://rl337.org/2012/03/15/pgm-class-and-octave/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://rl337.org/wp-content/uploads/2012/03/octave.png"><img class="alignright size-full wp-image-367" title="octave" src="http://rl337.org/wp-content/uploads/2012/03/octave.png" alt="" width="200" height="200" /></a>About a month and a half ago, I signed up for an on-line class called <a href="http://pgm-class.org">Probabilistic Graphical Models</a> in an attempt to learn a bit more about some of the math that we use at <a href="http://topsy.com">Topsy Labs</a>.</p>
<p>The strange logo to the right is the <a href="http://www.gnu.org/software/octave/">Octave</a> logo.  To quote the Octave website&#8230;</p>
<blockquote><p>GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments.</p></blockquote>
<p>Based on that description, it makes sense that this and <a href="http://www.mathworks.com/products/matlab/">Matlab</a> are the two languages recommended for this course.  Yeah. This means that I&#8217;ll be learning yet another language&#8230; but I&#8217;m hoping that octave will allow me to quickly generate cool visualizations for large data sets if not directly, then through <a href="http://www.gnuplot.info/">gnuplot</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://rl337.org/2012/03/15/pgm-class-and-octave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

