<?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>Top Down View</title>
	<atom:link href="http://www.topdownview.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.topdownview.com</link>
	<description>My View Of The World</description>
	<lastBuildDate>Tue, 21 Feb 2012 21:49:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Glitch and the LED Sneakers: Epilogue</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-epilogue</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 18:25:56 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=600</guid>
		<description><![CDATA[What now? Well, it was a one-off&#8230; a little bit of fun for the Glitch Launch Party and an excuse for me to explore the Arduino platform. However I just noticed today that the in-game shoes have a couple more tricks up their sleeves (do shoes have sleeves?). When you&#8217;re away from the keyboard in [...]]]></description>
			<content:encoded><![CDATA[<h5>What now?</h5>
<p>Well, it was a one-off&#8230; a little bit of fun for the Glitch Launch Party and an excuse for me to explore the Arduino platform. However I just noticed today that the in-game shoes have a couple more tricks up their sleeves (do shoes have sleeves?). When you&#8217;re away from the keyboard in the game and your Glitch falls asleep, the shoes pulse gently in time with your breathing. Also when you laugh or frown, the lights have their own emotions that mirror your character&#8217;s. This got me thinking about ways to extend the project.</p>
<p><span id="more-600"></span>One possible project might be to add the control button back into the system &#8211; pressing that would override the current effect for a limited amount of time to show an &#8220;emotional&#8221; effect. Maybe press once for laughing, twice rapidly for angry, three times for sleeping.</p>
<p>Another project might be to explore analogue control of the lights to allow a fading pattern. The Lilypad supports analogue out using a Pulse Width Modulation technique (ie it turns the pin on &amp; off rapidly&#8230; more on than off means brighter, more off than on means dimmer) &#8211; but the built-in support only works with 6 of the I/O pins so I&#8217;d have to investigate controlling the rapid on/off cycling myself.</p>
<p>Another project might be to add some sort of sensor to the system&#8230; maybe a resistive chest strap so it can tell my breathing pattern, or a thermo sensor so it can detect my temperature. The board could then alter the light patterns automatically to represent some aspect of my physical state.</p>
<h5>What Went Wrong</h5>
<p>In general the project went off really really smoothly. From both an electrical and software point of view it was very simple but I know that simple doesn&#8217;t always mean free of frustrating faults. I had no significant issues with either the electronics or the software, just a couple of minor niggles.</p>
<p>One &#8216;gotcha&#8217; was that the USB connection to the computer had to be wiggled just-so or else I would get power but no data to the Lilypad. At this point the Arduino software would see no serial port and fail to download to the board. Having hit this a couple of times I learnt how to spot it and wiggle the cable successfully.</p>
<p>Another hiccup was the power consumption with multiple LEDs on simultaneously. During initial testing with a single AAA cell, I found, at idle, the Lilypad was drawing about 9mA from the power supply board. With 2 LEDs on per side (4 total) that rose to 93mA. Because of the way the step-up electronics work, that worked out at 230mA from the actual cell. If I tried to turn on more LEDs the cell couldn&#8217;t supply enough current and the Lilypad reset. I minimised the peak battery loading by careful construction of the flashing patterns to alternate the shoes on/off cycles but I replaced the single AAA cell with a three pack for extra safety. Reading the <a href="http://www.onsemi.com/pub_link/Collateral/NCP1400A-D.PDF">datasheet for the NCP1400A</a> voltage converter chip says the chip has a 100mA maximum output current so I think I was lucky to be able to get as much out of it as I did.</p>
<h5>What Would I Do Differently</h5>
<p>There were a couple of things that I&#8217;d do differently if I did the project over again.</p>
<p>First, I&#8217;d take into account the way that the straps sat on the shoes before I glued the LED ribs on to them. The stretchy straps lean slightly forwards because of the slope of the shoe &#8211; I didn&#8217;t think of this and I glued the LED ribs onto them at right angles and so they&#8217;re on a slope rather than being parallel to the ground. If I&#8217;d tried the shoes and straps on first, before I got the glue gun out, I could have glued the LED ribs on at an angle so they remained flush and level to the ground.</p>
<p>Secondly, I&#8217;d choose a different power supply. There&#8217;s some really nice <a href="http://www.sparkfun.com/products/339">Lithium Polymer batteries</a> available, supplying 3.7v with a capacity of 1000mAh or more. The <a href="http://www.sparkfun.com/products/8786">power supply board for this</a> is electrically almost identical to the AAA board, the only addition being an over-current protector &#8211; which might actually be overkill as the NCP1400A has a 350mA current limiter built-in. I think this would have been a little neater than my contraption with the 3xAAA cells. Although, given that I didn&#8217;t have to buy a separate charger, or a battery, the solution I ran with was actually cheaper and more flexible.</p>
<p>&nbsp;</p>
<p>All in all, a great success and I&#8217;m looking forward to having some more fun with Arduino (Lilypad or otherwise) in the future &#8211; as soon as I can think of another excuse!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-epilogue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; In Action!</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-in-action</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 18:16:44 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=587</guid>
		<description><![CDATA[So it&#8217;s all put together&#8230; but what do they look like? Show us! OK, OK&#8230; your patience is finally rewarded, here&#8217;s a video of what they look like in action: &#160; If you&#8217;re so inclined, here&#8217;s a more detailed video walk-through showing all the bits &#38; pieces plus the shoes in action: &#160; In case the videos [...]]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s all put together&#8230; but what do they look like? Show us!</p>
<p>OK, OK&#8230; your patience is finally rewarded, here&#8217;s a video of what they look like in action:</p>
<p><span id="more-587"></span><br />
<object type="application/x-shockwave-flash" width="640" height="361" data="http://www.flickr.com/apps/video/stewart.swf?v=109786" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&#038;photo_secret=03c4b44ae7&#038;photo_id=6323539289"></param><param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=109786"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=109786" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&#038;photo_secret=03c4b44ae7&#038;photo_id=6323539289" height="361" width="640"></embed></object>
</p>
<p>&nbsp;</p>
<p>If you&#8217;re so inclined, here&#8217;s a more detailed video walk-through showing all the bits &amp; pieces plus the shoes in action:</p>
<p><iframe src="http://www.youtube.com/embed/YaFkh5pO_rM" frameborder="0" width="560" height="315"></iframe></p>
<p>&nbsp;</p>
<p>In case the videos don&#8217;t work for you, the originals are on Flickr and YouTube, <a title="shoe demo on flickr" href="http://www.flickr.com/photos/55055992@N00/6323539289/">here</a> and <a title="Full shoe walkthrough (ha) and demo on YouTube" href="http://www.youtube.com/watch?v=YaFkh5pO_rM">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Putting It All Together</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-putting-it-all-together</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 17:08:48 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=560</guid>
		<description><![CDATA[At this point I&#8217;ve got a jumble of wires, crocodile clips and circuit boards spread across half my desk. Nothing too shoe-related going on yet and definitely not portable. To bring this to life, I needed two basic set of things: something in which to mount the Lilypad, power board and batteries. My original idea [...]]]></description>
			<content:encoded><![CDATA[<p>At this point I&#8217;ve got a jumble of wires, crocodile clips and circuit boards spread across half my desk. Nothing too shoe-related going on yet and definitely not portable.</p>
<p>To bring this to life, I needed two basic set of things:</p>
<ul>
<li>something in which to mount the Lilypad, power board and batteries. My original idea was something along the lines of a money belt with the Lilypad in the small of my back and a wire to the button somewhere easily accessible</li>
<li>something to hold the LEDs and attach to the shoes. I wasn&#8217;t going to modify the shoes in any way so my original idea was some sort of a fabric overshoe sewn together and held in place with stretchy straps and velcro.</li>
</ul>
<p><span id="more-560"></span>Really it all comes down to what you can find&#8230; you have to be imaginative and flexible with your plans. I took a trip to my local thrift store and mooched around all the aisles. Then I mooched around them all again. After many &#8220;maybes&#8221;, instead of the money belt, I settled on a small leather camera case with a belt loop and for the shoe end of things I picked up (an awesome find for $1.50) a back support belt. Yes really. The belt was 8 inches wide, had rigid vertical ribs like a corset (once detached, these would be great to mounting the LEDs onto) and was held up by a set of stretchy braces (suspenders for you North Americans) (which would provide all the stretchy straps I needed) and held together by loads of velcro tabs &amp; fasteners. Just perfect &#8211; a tripartite triumph.</p>
<h4>Shoe Pieces</h4>
<p>Once home, I started with the shoe pieces. I cut out a pair of the ribs from the back support belt and hot glued the LEDs in place across the front. The wiring consisted of a common 0v wire running the length of the rib just below the LEDs and the individual signal wires looped up over the top. More hot glue on the back held everything in place. I cut lengths of stretchy strap from the braces and hand-sewed velcro onto the end (note to self: don&#8217;t ever hand-sew velcro again&#8230; ow ow ow) &#8211; this would then wrap around the shoe and fasten back onto itself with the LED rib glued onto the strap at the appropriate point. I cut 8 inches off the end of the ribbon cable and split it into two 5-way wires &#8211; one for each foot. These 5 wires I then soldered to the LED wires on the back of the ribs and attached the ribs to the stretchy straps with a big squirt of hot glue, sandwiching all the solder joints in the middle &#8211; so no exposed bare wires. Then I soldered the male (PCB mount) half of the Insulation Displacement Connectors onto the other ends of the 5-way wires (the smallest IDCs that Lee&#8217;s stocked were 10-way so half the pins were unused but, at under a buck a connector, I&#8217;m not complaining). Finally, to protect the soldered joints (and to protect my ankles from the soldered joints) I wrapped an inch of heat-shrink tubing around the connector and squirted another big blob of hot glue up the open end of the heat shrink to act as a strain relief. And the shoe pieces were complete.</p>
<p style="text-align: center;"><a title="Glitch shoes - the LED shoe piece by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320228181/"><img class="aligncenter" src="http://farm7.static.flickr.com/6225/6320228181_3b912ea026.jpg" alt="Glitch shoes - the LED shoe piece" width="500" height="376" /></a></p>
<h4>Power &amp; control unit</h4>
<p>In theory the Lilypad can be run from a single AAA cell fitted to the power supply board. This will step-up anything from as low as 1.2v into the 5.0v needed to power the Lilypad. This worked initially but I found that driving too many LEDs at once required too much current for the single cell to provide reliably and the Lilypad would reset itself. Instead I borrowed a 3xAAA holder from an old flashlight, fitted three 750mAh AAA NiMH cells into that and soldered the output onto the power board. Now I&#8217;ve got about 4v and 2000mAh capacity&#8230; should be plenty. As a quick test I let the system sit with all 8 LEDs on for a while and it took 90 minutes to drain. Great &#8211; I&#8217;ll pack a backup set of batteries and I should be fine.</p>
<p>A two foot length cut from the 10-way ribbon cable comes up into the camera case through a small hole I cut in the bottom and is then soldered directly onto the I/O pins of the Lilypad. I decided that it was good to show off the controller so I hot glued a patch of velcro onto the back of it &amp; a corresponding piece onto the front of the case so I could mount it there. This also gave me access to the reset button that I could now easily use for changing modes.</p>
<p style="text-align: center;"><a title="Glitch shoes - power &amp; control unit by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320206345/"><img class="aligncenter" src="http://farm7.static.flickr.com/6051/6320206345_6514fb55e8.jpg" alt="Glitch shoes - power &amp; control unit" width="500" height="376" /></a></p>
<p>The whole contraption then slips onto a belt with the batteries in the bottom of the camera bag and the power supply board on top of them for easy access to the power switch. The cable comes out of the bottom of the case and attaches to the cable coming up the legs with any excess being easily hidden in a pocket.</p>
<p style="text-align: center;"><a title="Glitch shoes - control pack by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320266929/"><img src="http://farm7.static.flickr.com/6041/6320266929_634b8feab1.jpg" alt="Glitch shoes - control pack" width="376" height="500" /></a></p>
<h4>Connecting Cable</h4>
<p>Connecting the control &amp; power unit to the feet was easy. I took the remaining length of 10-way ribbon cable, ripped it up the middle for most of its length and attached connectors to the three ends. The 10-way will connect to the control &amp; power unit, the two 5-ways will connect to the shoe pieces and most of the wiring will be hidden inside my jeans.</p>
<p><a title="Glitch shoes - connecting cable by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6320752940/"><img class="aligncenter" src="http://farm7.static.flickr.com/6036/6320752940_a2d61cce7c.jpg" alt="Glitch shoes - connecting cable" width="500" height="376" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-putting-it-all-together/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Final Code</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-final-code</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 05:48:35 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=534</guid>
		<description><![CDATA[I had a couple of sets of changes I needed to make to my test code. Firstly I needed the ability to change the effects mode using the button. I originally added this by testing to see if the button was down, incrementing a global variable that I used for the mode, a switch statement [...]]]></description>
			<content:encoded><![CDATA[<p>I had a couple of sets of changes I needed to make to my test code.</p>
<p>Firstly I needed the ability to change the effects mode using the button. I originally added this by testing to see if the button was down, incrementing a global variable that I used for the mode, a switch statement to divert program flow depending on the current mode value and different functions for each effects mode. The effect was pretty to look at but the code was even worse than the previous test: overly long and the patterns were defined by the actual program logic &#8211; meaning that more program code would have to be written in order to add more patterns and the code to control 8 LEDs would be twice as long. You can see that particular iteration here: <a href="http://topdownview.com/arduino/glitch/Glitch_multimode">http://topdownview.com/arduino/glitch/Glitch_multimode</a></p>
<p><span id="more-534"></span>When I was trying to come up with a clever design for storing the LED patterns, I kept wanting to use objects&#8230; it was very hard to constrain myself to simple procedural C!</p>
<p>I chose to do a lot of work with arrays. To start with, I could put the pins used by the LEDs into an array:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"> <span class="kw4">int</span> ledPins<span class="br0">&#91;</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="nu0">5</span><span class="sy0">,</span> <span class="nu0">6</span><span class="sy0">,</span> <span class="nu0">7</span><span class="sy0">,</span> <span class="nu0">8</span><span class="sy0">,</span> <span class="nu0">9</span><span class="sy0">,</span> <span class="nu0">10</span><span class="sy0">,</span> <span class="nu0">11</span><span class="sy0">,</span> <span class="nu0">12</span> <span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>and then reset them all in setup() like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw4">int</span> pin <span class="sy0">=</span> <span class="nu0">0</span> <span class="sy0">;</span> pin <span class="sy0">&amp;</span>lt<span class="sy0">;</span> numLeds <span class="sy0">;</span> pin<span class="sy0">++</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  pinMode<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>pin<span class="br0">&#93;</span><span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
  digitalWrite<span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span>pin<span class="br0">&#93;</span><span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>And I put the effects modes into an array. The first design looked like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> pattern<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">5</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="nu0">100</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">500</span><span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">200</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span>  ON<span class="br0">&#125;</span><span class="sy0">,</span>
                     <span class="br0">&#123;</span> <span class="nu0">400</span><span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="sy0">,</span> OFF<span class="br0">&#125;</span><span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>with the first parameter being the number of milliseconds to hold a specific display. You can see a version of code that uses that array format here: <a href="http://topdownview.com/arduino/glitch/Glitch_pattern_array">http://topdownview.com/arduino/glitch/Glitch_pattern_array</a></p>
<p>Then I realized I could use binary for the individual on/off LEDs (which scaled very easily for the 8 LEDs I needed) plus I needed a way to store the different effects modes. So I ended up with an array structure like this:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"> <span class="kw4">int</span> pattern<span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">3</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="br0">&#123;</span> <span class="br0">&#123;</span> <span class="nu0">0</span><span class="sy0">,</span><span class="nu0">9000</span><span class="sy0">,</span> B00000000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 0: Everything off</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B10000000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 1: 2 LEDs run down the length of the line</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B11000000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B01100000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00110000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00010000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00001000<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00001100<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000110<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000011<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">1</span><span class="sy0">,</span>  <span class="nu0">80</span><span class="sy0">,</span> B00000001<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B10001000<span class="br0">&#125;</span><span class="sy0">,</span>  <span class="co1">// mode 2: 1 LED runs down the length of the line</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B01000100<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00100010<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00010001<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B00100010<span class="br0">&#125;</span><span class="sy0">,</span>
                      <span class="br0">&#123;</span> <span class="nu0">2</span><span class="sy0">,</span> <span class="nu0">150</span><span class="sy0">,</span> B01000100<span class="br0">&#125;</span><span class="br0">&#125;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>Here the first parameter of each row is the effects mode that this line refers to, the second parameter is the length of time to hold that display and the third parameter is a binary bit-field for the 8 LEDs. Now any time I want to add a new effects mode it&#8217;s as simple as adding new lines to the array &#8211; no new program logic required. The program code steps through the array after each timing period looking for the next line that applies to the current effects mode and, if it reaches the end of the array, loops back to the start.</p>
<p>I was able to decouple the program logic from the size of the arrays by having the program work out the array sizes for itself in setup():</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">    numSteps <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>pattern<span class="br0">&#41;</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>pattern<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    numLeds <span class="sy0">=</span> <span class="kw4">sizeof</span><span class="br0">&#40;</span>ledPins<span class="br0">&#41;</span><span class="sy0">/</span><span class="kw4">sizeof</span><span class="br0">&#40;</span>ledPins<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>Again, in an OO language I&#8217;d have just used foreach to step through the arrays, but here I had to work without that luxury.</p>
<p>At one point I had the button generating an interrupt to increment the effects mode. But, as I was wiring up the hardware, I thought &#8220;it&#8217;s damn awkward having this button floating around&#8230; I wish there was some way I could use the button that&#8217;s already on the Lilypad board&#8221;. That button&#8217;s the reset button&#8230; so <em>obviously</em> I couldn&#8217;t do that because everything&#8217;s erased when the board&#8217;s reset. Hmmm&#8230; except the microcontroller has some EEPROM for storage that <em>isn&#8217;t</em> erased on reset. So I changed the code to store the effects mode in the EEPROM and increment the mode each time it resets. Then I didn&#8217;t need the separate button at all &#8211; every time the reset button&#8217;s pressed the Lilypad starts up in the next sequential effects mode. This had another major benefit: if the board reset itself (and I was initially fearing possible power-drain related resets for modes that illuminated too many LEDs at the same time) then when it restarted it would magically skip over the problematic mode.</p>
<p>The only other oddity in the code was how to deal with detecting when we&#8217;d stepped through all the available effects modes and had to set the mode back down to zero. In hindsight, I probably should have run through the pattern array in setup() to determine the highest mode value and then compared against that whenever I incremented the current mode. What I actually did was: when I was about to go hunting for the next line that referred to the current pattern, the code memorizes where in the pattern array it&#8217;s starting its search and then if it steps all the way around and back to the same line without finding a match, that means the mode variable is now too high and has to be set back to zero. So my &#8220;find the next matching pattern line&#8221; code looks like:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> startStep <span class="sy0">=</span> currentStep<span class="sy0">;</span> <span class="co1">// Remember where we started from in the pattern array</span>
&nbsp;
<span class="co1">// Loop through the array looking for the next pattern line that matches our</span>
<span class="co1">// current effects mode</span>
<span class="kw1">while</span> <span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  currentStep<span class="sy0">++;</span> <span class="co1">// move to next step</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>currentStep <span class="sy0">&amp;</span>gt<span class="sy0">;=</span> numSteps<span class="br0">&#41;</span> currentStep<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span> <span class="co1">// at end of array, loop back to start</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>pattern<span class="br0">&#91;</span>currentStep<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">==</span> modeGet<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw2">break</span><span class="sy0">;</span> <span class="co1">// this pattern line applies to this mode, so use it</span>
  <span class="kw1">if</span> <span class="br0">&#40;</span>currentStep <span class="sy0">==</span> startStep<span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// if been all the way around, we have nothing for this mode</span>
    modeSet<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">// so reset the mode back to the first mode</span>
    currentStep <span class="sy0">=</span> <span class="sy0">-</span><span class="nu0">1</span><span class="sy0">;</span> <span class="co1">// and start searching from the beginning of the pattern array</span>
    Serial.<span class="me1">println</span><span class="br0">&#40;</span><span class="st0">&quot;Looped around - clearing mode&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>The full and final code can be seen here:  <a href=" http://topdownview.com/arduino/glitch/Glitch_final_code">http://topdownview.com/arduino/glitch/Glitch_final_code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-final-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; First Test</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-first-test</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/#comments</comments>
		<pubDate>Sat, 05 Nov 2011 01:27:20 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=522</guid>
		<description><![CDATA[At this point I broke out the croc clips and the LEDs and started experimenting. Whenever you click &#8216;Upload&#8217; in the Arduino IDE it compiles your current code, transfers it to your Lilypad, reboots the Lilypad and starts the code running &#8211; so the feedback loop for trying out ideas &#38; seeing what works is [...]]]></description>
			<content:encoded><![CDATA[<p>At this point I broke out the croc clips and the LEDs and started experimenting. Whenever you click &#8216;Upload&#8217; in the Arduino IDE it compiles your current code, transfers it to your Lilypad, reboots the Lilypad and starts the code running &#8211; so the feedback loop for trying out ideas &amp; seeing what works is very fast.</p>
<p>My first test hardware involved connecting the button and 4 of the LEDs to pads on the Lilypad. I started from the basic Blink program and added more LEDs and more delays to give some visual effects. I also added the ability to detect button presses in order to change the pattern.</p>
<p><span id="more-522"></span>I defined a couple of constants in my code:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw4">int</span> pin1 <span class="sy0">=</span> <span class="nu0">9</span><span class="sy0">;</span>
<span class="kw4">int</span> pin2 <span class="sy0">=</span> <span class="nu0">10</span><span class="sy0">;</span>
<span class="kw4">int</span> pin3 <span class="sy0">=</span> <span class="nu0">11</span><span class="sy0">;</span>
<span class="kw4">int</span> pin4 <span class="sy0">=</span> <span class="nu0">3</span><span class="sy0">;</span>
<span class="kw4">int</span> pinButton <span class="sy0">=</span> <span class="nu0">12</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>then I needed to add code into setup() to tell the Lilypad how the hardware was configured:</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">pinMode<span class="br0">&#40;</span>pin1<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin2<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin3<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pin4<span class="sy0">,</span> OUTPUT<span class="br0">&#41;</span><span class="sy0">;</span>
pinMode<span class="br0">&#40;</span>pinButton<span class="sy0">,</span> INPUT<span class="br0">&#41;</span><span class="sy0">;</span>
digitalWrite<span class="br0">&#40;</span>pinButton<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>The digitalWrite() for a pin configured as an input might seem counter-intuitive but it&#8217;s an important step. It makes the Lilypad connect the input line to an internal pull-up resistor so that, when the line isn&#8217;t pulled down to 0v by the button being pressed, the line is at a solid 5v. Omit this line and you&#8217;ll get a lot of spurious signals from the button as the Lilypad tries to work out what the floating input line is doing.</p>
<p>Then in the main loop() code I can use</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1"><span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>digitalRead<span class="br0">&#40;</span>pinButton<span class="br0">&#41;</span> <span class="sy0">==</span> LOW<span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="co1">// code goes in here for when the button's pressed</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
  <span class="co1">// code goes in here for when the button's not pressed</span>
<span class="br0">&#125;</span></pre></div></div></div></div></div></div></div>


<p>to detect if the button is down and adjust the output accordingly. The first code block contains</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="c"><pre class="de1">  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>  <span class="co1">// turn on the first LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the second LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the third LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// turn on the fourth LED</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> HIGH<span class="br0">&#41;</span><span class="sy0">;</span>   
  delay<span class="br0">&#40;</span>speed<span class="br0">&#41;</span><span class="sy0">;</span>              
  digitalWrite<span class="br0">&#40;</span>pin1<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   <span class="co1">// and turn them all off</span>
  digitalWrite<span class="br0">&#40;</span>pin2<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin3<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
  digitalWrite<span class="br0">&#40;</span>pin4<span class="sy0">,</span> LOW<span class="br0">&#41;</span><span class="sy0">;</span>   
&nbsp;
  delay<span class="br0">&#40;</span>speed2<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


<p>and the second code block contains pretty much duplicated code but with the lit LED rotating in the opposite direction.</p>
<p>And yay &#8211; ugly but it worked!<br />
See the full source code for this test here: <a href="http://topdownview.com/arduino/glitch/Glitch_multimode">http://topdownview.com/arduino/glitch/Glitch_first_test</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-first-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Hello World</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-hello-world</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 23:43:22 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=504</guid>
		<description><![CDATA[So now it&#8217;s time to plug things together and start programming. The Arduino development environment is super simple to work with. The tools are written in Java so they&#8217;re cross-platform. If you&#8217;re running Ubuntu then installation is simply a matter of visiting the Software Centre, typing in &#8216;Arduino&#8217; and clicking the install button for the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.topdownview.com/wp-content/uploads/2011/11/Blink-Arduino-0022_079.png"><img class="alignright size-medium wp-image-505" title="Blink | Arduino 0022_079" src="http://www.topdownview.com/wp-content/uploads/2011/11/Blink-Arduino-0022_079-300x293.png" alt="" width="300" height="293" /></a>So now it&#8217;s time to plug things together and start programming.</p>
<p>The Arduino development environment is super simple to work with. The tools are written in Java so they&#8217;re cross-platform. If you&#8217;re running Ubuntu then installation is simply a matter of visiting the Software Centre, typing in &#8216;Arduino&#8217; and clicking the install button for the Arduino IDE program that pops up. If you&#8217;re on Windows or Mac then it&#8217;s not much more complicated than that either &#8211; download the software from the <a href="http://arduino.cc/en/Main/Software">Arduino website</a> and install.</p>
<p>Then plug one end of the programming cable into your Lilypad (be sure to get it the right way round &#8211; the board is marked B and G for the Black and Green wires in the cable) and the other end into your computer. At this point your computer discovers a new serial port provided by the USB cable &#8211; again if you&#8217;re running Ubuntu it just works but if you&#8217;re running Windows to Mac there&#8217;s help <a href="http://web.media.mit.edu/~leah/LilyPad/02_software.html">here</a> to guide you through installing the necessary device drivers.</p>
<p>Run the Arduino IDE and go to Tools-&gt;Board to select the correct board that you&#8217;re programming. In my case it&#8217;s the &#8220;Lilypad Arduino w/ATmega328&#8243;. Then click on Tools-&gt;SerialPort to check that your system&#8217;s detected and selected the correct serial port.</p>
<p><span id="more-504"></span>Now you&#8217;re ready to go! The IDE contains over a hundred simple program examples to get you started with whatever piece of code functionality or add-on hardware you&#8217;re trying to use. The Arduino equivalent of Hello World is called Blink and we can use it now to test out our Lilypad and workflow. The Lilypad contains an LED already mounted to the board so we can run the Blink program (File-&gt;Examples-&gt;Basics-&gt;Blink) without having to attach any extra hardware.</p>
<pre>/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/</pre>
<pre>void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH); // set the LED on
  delay(1000); // wait for a second
  digitalWrite(13, LOW); // set the LED off
  delay(1000); // wait for a second
}</pre>
<p>Arduino code is written in C so if you&#8217;ve got any programming experience it isn&#8217;t going to take long to pick up. The program that you write gets compiled on your computer and then transferred to the Arduino where it&#8217;s run by a boot loader program. The boot loader program expects to find two functions in your code:</p>
<ul>
<li><strong>setup()</strong> is called once when the program starts up. Use this for initializing variables and setting the mode (input or output) of the various I/O pins</li>
<li><strong>loop()</strong> is called repeatedly. Depending on your task and your personal programming style you can keep control within loop() or you can let the program flow fall out the bottom and have the boot loader call you again.</li>
</ul>
<p>The example Blink program flashes the Lilypad&#8217;s on-boad LED: one second on, one second off and repeat until you unplug it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED sneakers &#8211; The Parts</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-the-parts</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 22:41:14 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=492</guid>
		<description><![CDATA[First things first&#8230; what&#8217;s the final design going to look like? My plan was for 4 LEDs along the outside edge of each shoe &#8211; 2 red and 2 yellow to match the colours of the Glitch shoes. Then run wires up inside each leg of my jeans to the Lilypad and power supply mounted [...]]]></description>
			<content:encoded><![CDATA[<p>First things first&#8230; what&#8217;s the final design going to look like? My plan was for 4 LEDs along the outside edge of each shoe &#8211; 2 red and 2 yellow to match the colours of the Glitch shoes. Then run wires up inside each leg of my jeans to the Lilypad and power supply mounted around my waist. Add a button to allow switching between different flashing modes and some connectors at the ankle and waist to allow things to be detached and we&#8217;re set.</p>
<p>So what hardware are we going to need?</p>
<p><span id="more-492"></span></p>
<p>We&#8217;ll need:<br />
<a style="float: right; margin: 10px;" title="Parts list by Jon.Jennings, on Flickr" href="http://www.flickr.com/photos/55055992@N00/6313271418/"><img src="http://farm7.static.flickr.com/6229/6313271418_88eede7851_m.jpg" alt="the components" width="340" /></a></p>
<ul>
<li>a <a href="http://arduino.cc/en/Main/ArduinoBoardLilyPad">Lilypad Arduino</a> &#8211; the programmable microcontroller that drives everything. It&#8217;s got 14 digital I/O pins that can drive LEDs directly</li>
<li>a <a href="http://www.sparkfun.com/products/8466">power supply</a> &#8211; this lovely little board takes a single 1.5v AAA cell and steps it up to 5v to drive the Lilypad. However I think I&#8217;d power it differently if I was doing things over again</li>
<li>a <a href="http://www.sparkfun.com/products/9717">cable</a> to connect it to a computer for programming. This is USB at one end and serial at the other with a connector that plugs directly onto the Lilypad for downloading programs, communication back to the computer and power</li>
<li>8 <a href="http://www.sparkfun.com/products/10044">LEDs</a> &#8211; I used LEDs specifically designed to complement Lilypad</li>
<li>a <a href="http://www.sparkfun.com/products/8776">button</a> for changing modes &#8211; again this is specifically designed for the Lilypad line, although I ended up not using it in the final design</li>
<li>lots of wire &amp; connectors</li>
</ul>
<p>For wiring, I need a signal line for each LED down each leg, plus a common 0v line &#8211; so 5 wires per leg. I visited <a href="http://www.leeselectronic.com/">Lee&#8217;s Electronics</a> on Main Street in Vancouver for parts (they&#8217;ve got loads of Arduino items but if you&#8217;re not local then <a href="http://www.sparkfun.com/">SparkFun</a> are a great online source for everything Arduino) and I took the brave decision to explain to the assistant exactly what I was planning to do with this hardware, rather than just swan in and give him my parts list. He was really helpful and suggested ribbon wire for the wiring. This was a smart move as it&#8217;s cheap, low bulk and meant I could use <a href="http://en.wikipedia.org/wiki/Insulation-displacement_connector">insulation displacement connectors</a> for one half of each connector, eliminating half the fiddly wiring. It also looks cool if you&#8217;re into the whole &#8216;visible electronics&#8217; thing. If you&#8217;re into e-textiles then you can actually buy <a href="http://www.sparkfun.com/categories/206">electrically conductive thread</a> and sew your circuit into your clothes. Pretty amazing but I was just looking for a temporary solution and I didn&#8217;t fancy the idea of sewing 5 lines down each pant leg.</p>
<p>I bought 9 foot of 10-way ribbon cable which, even allowing for lots of slack in the system, turned out to be about 2 foot too much (but I knew I was buying too much: it&#8217;s like <a href="http://www.flickr.com/photos/55055992@N00/sets/72157626282251139/">haircuts</a>&#8230; it&#8217;s much easier to take off a little more at the end than it is to add some back on). Another great thing with the ribbon cable: you can just tear it up the middle and suddenly, with no extra work, you&#8217;ve got a cable that&#8217;s 10-way at one end and splits into two 5-way cables at the other end!</p>
<p>One downside of the insulation displacement connectors is that the male side of the connector is usually soldered into a circuit board. Nobody ever uses them for in-line connectors (as I was trying to do) so the only option I had for the male connector was a PCB mount variant with exposed pins on the back side. This makes for rather fiddly soldering and a connector that&#8217;s far from ideal for wearing, so I added a length of heat-shrink tubing to my basket.</p>
<p>And finally, I also bought a pack of crocodile clip test leads for prototyping. I knew I had a set at home somewhere but you can never have enough crocodile clip leads &#8211; and actually, even having found the second set I had at home, I didn&#8217;t have enough leads to fully wire-up the 8 LED design with crocodile leads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-the-parts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Glitch and the LED Sneakers &#8211; Intro</title>
		<link>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=glitch-and-the-led-sneakers-intro</link>
		<comments>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/#comments</comments>
		<pubDate>Fri, 04 Nov 2011 21:25:17 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[e-textiles]]></category>
		<category><![CDATA[glitch]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[led sneakers]]></category>
		<category><![CDATA[lilypad]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tiny speck]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=480</guid>
		<description><![CDATA[I&#8217;ve been playing Tiny Speck&#8216;s Glitch for the last six months. I don&#8217;t play much in the way of computer games these days &#8211; I don&#8217;t play MMOs and I run Linux so I don&#8217;t exactly have a bundle of games at my disposal, but Glitch is different. The game is a lot of fun, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing <a href="http://tinyspeck.com/">Tiny Speck</a>&#8216;s <a href="http://www.glitch.com/">Glitch</a> for the last six months. I don&#8217;t play much in the way of computer games these days &#8211; I don&#8217;t play MMOs and I run Linux so I don&#8217;t exactly have a bundle of games at my disposal, but Glitch is different. The game is a lot of fun, the artwork is beautiful and the writing is consistently funny and quirky &#8211; but what really elevates the game are the people:</p>
<p><span id="more-480"></span></p>
<p>- the player community is very friendly&#8230; it&#8217;s not unusual to have strangers give you items or strike up conversations with you as you walk down the street. This is a game where there&#8217;s no player-player combat and very little opportunity to cause your fellow players grief so it maybe shouldn&#8217;t be surprising that it attracts a different type of player</p>
<p>- the developers are amazingly open and involved&#8230; it&#8217;s not unusual to see company founder Stewart Butterfield in the forums engaging in debate about a new game addition or to see a player suggestion appearing in the game</p>
<p>I don&#8217;t think I&#8217;ve ever seen a game that encouraged player-player interactions and the whole concept of &#8220;paying it forward&#8221; as much as this game. There&#8217;s a unique thrill to be got from helping out a less experienced player with some food or advice &#8211; it makes them feel valued within the game and you know that they&#8217;ll want to repay your kindnesses to others later on. Plus the players create stuff of their own to have fun with: lotteries, casinos, quests, challenges&#8230; almost universally group events.</p>
<p><a href="http://www.topdownview.com/wp-content/uploads/2011/11/glitch-me.png"><img class="alignright size-full wp-image-482" title="glitch-me" src="http://www.topdownview.com/wp-content/uploads/2011/11/glitch-me.png" alt="" width="172" height="248" /></a> Glitch came out of beta a month ago and the quiet world of the beta testers has been swamped by tens of thousands of new eager players discovering everything for the first time. The developers have done a great job surviving the onslaught and still introducing a whole raft of new features. To celebrate the launch, Tiny Speck put on a party here in Vancouver last night &amp; I was lucky enough to snag myself a ticket.</p>
<p>Hmmmmm&#8230; what to wear, what to wear? Well the invite made mention of dress-up and a tickle trunk so I think some sort of costume is called for. The obvious choice is to dress as my Glitch and fortunately that&#8217;s not too difficult or outrageous &#8211; he basically wears all black LOL. However he does have the most incredible pair of LED shoes with a row of lights that strobe down the sides. Hmmm&#8230; actually, you know what&#8230; I could absolutely make those. <a href="http://johnbiehler.com/">John Biehler</a> introduced me to the <a href="http://www.arduino.cc/">Arduino</a> microcontroller platform last year and I&#8217;ve been wanting a nice little project to implement with it. Even better, there&#8217;s an Arduino variant called <a href="http://arduino.cc/en/Main/ArduinoBoardLilyPad">Lilypad</a>, created by <a href="http://web.media.mit.edu/~leah/index.html">Leah Buechley</a> at the MIT Media Lab, specifically for wearable electronics.</p>
<p>So yeah &#8211; with a little bit of programming, some fairly cheap electronics, a visit to the thrift store and a lot of hot glue, I built myself a set of flashing light shoes. With multiple modes! The shoes were a big hit at the party and I lost count of the number of people who came up to me to comment on them.</p>
<p>Both the Arduino and Glitch communities are heavy on the concept of sharing, so I&#8217;ll be posting details of the shoes&#8217; construction and software here (in great detail!). If you&#8217;re interested in Arduino then you&#8217;ll probably find something of use in each of the posts. If your interest is purely Glitch and non-technical then you might want to skip the geekery and jump straight to the <a title="Glitch and the LED Sneakers – In Action!" href="http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-in-action/">demo video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/11/glitch-and-the-led-sneakers-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art Of Marketing 2012</title>
		<link>http://www.topdownview.com/2011/06/the-art-of-marketing-2012/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-art-of-marketing-2012</link>
		<comments>http://www.topdownview.com/2011/06/the-art-of-marketing-2012/#comments</comments>
		<pubDate>Tue, 14 Jun 2011 19:19:54 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[speakers]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=475</guid>
		<description><![CDATA[Nope, not a typo &#8211; an attendee survey just landed in my inbox and one of the questions was asking who I&#8217;d like to see speak at next year&#8217;s Art Of Marketing. One of the comments I heard many times last week was &#8220;isn&#8217;t it odd there&#8217;s no women speaking here?&#8221;. If you assume that [...]]]></description>
			<content:encoded><![CDATA[<p>Nope, not a typo &#8211; an attendee survey just landed in my inbox and one of the questions was asking who I&#8217;d like to see speak at <em>next year&#8217;s</em> <a href="http://www.theartofmarketing.ca/">Art Of Marketing</a>.</p>
<p>One of the comments I heard many times last week was &#8220;isn&#8217;t it odd there&#8217;s no women speaking here?&#8221;. If you assume that women are equally represented in the field of marketing speakers, you&#8217;ve got a 0.5^5 chance of getting an all-male schedule. Wow&#8230; that&#8217;s one in 32 (yes, maths was my first love).</p>
<p>So, whilst I&#8217;m not in favour of positive discrimination, I was quite keen to get a couple of women on the schedule for next year. Let&#8217;s take a look at their suggestions on the survey form:</p>
<p><a href="http://www.bizstone.com/" target="_blank">Biz Stone</a> &#8211; co-founder Twitter<br />
<a href="http://charlene-lee.com/charlene-lee-designer-creative-director.html" target="_blank">Charlene Lee</a> &#8211; shoe designer<br />
<a href="http://madetostick.com/theauthors/" target="_blank">Chip Heath</a> &#8211; professor of Organizational Behavior and co-author of &#8220;Made To Stick&#8221;<br />
<a href="http://www.longtail.com/about.html" target="_blank">Chris Anderson</a> &#8211; editor-in-chief of Wired, author of &#8220;The long Tail&#8221;<br />
<a href="http://www.chrisbrogan.com/" target="_blank">Chris Brogan</a> &#8211; speaker, blogger, co-author of &#8220;Trust Agents&#8221;<br />
<a href="http://danariely.com/" target="_blank">Dan Ariely</a> &#8211; professor of behavioral economics and author of &#8220;Predictably Irrational&#8221;<br />
<a href="http://www.thebackofthenapkin.com/about_me.php" target="_blank">Dan Roam</a> &#8211; author &#8220;The Back Of The Napkin&#8221;<br />
<a href="http://en.wikipedia.org/wiki/Dana_White" target="_blank">Dana White</a> &#8211; president of the Ultimate Fighting Championship<br />
<a href="http://www.danpink.com/about" target="_blank">Daniel Pink</a> &#8211; author of &#8220;Drive&#8221;, speechwriter and motivational speaker<br />
<a href="http://garyvaynerchuk.com/" target="_blank">Gary Vaynerchuk</a> &#8211; wine expert, founder of winelibrary.tv, author of &#8220;Crush It&#8221;<br />
<a href="http://www.guykawasaki.com/about/" target="_blank">Guy Kawasaki</a> &#8211; co-founder of alltop.com, previously chief evangelist at Apple, author of &#8220;Enchantment&#8221;<br />
<a href="http://www.gladwell.com/bio.html" target="_blank">Malcolm Gladwell</a> &#8211; author &#8220;The Tipping Point&#8221;, writer for NYT<br />
<a href="http://en.wikipedia.org/wiki/Mark_Zuckerberg" target="_blank">Mark Zuckerberg</a> &#8211; founder Facebook<br />
<a href="http://taxi.ca/index.php/drivers" target="_blank">Paul Lavoie</a> &#8211; Co-founder TAXI (advertising agency)<br />
<a href="http://www.sethgodin.com/sg/" target="_blank">Seth Godin</a> &#8211; speaker, blogger, author of &#8220;Tribes&#8221;<br />
<span style="font-size: 10px; font-weight: bold;">[links will open in another window/tab]</span></p>
<p>They did allow space  for a write-in, but their suggestions are 14 men and 1 woman.<br />
And I&#8217;m not entirely sure they mean Charlene Lee&#8230; I suspect they might actually mean <a href="http://www.charleneli.com/" target="_blank">Charlene Li</a> &#8211; author of &#8220;Open leadership&#8221; and co-author of &#8220;Groundswell&#8221;.</p>
<p>Is there something wrong here? Clearly there is. But where&#8217;s the problem? Is it that the people behind The Art Of Marketing are horrendously sexist? Somehow I doubt it. Is it that marketing is an almost exclusively male preserve? Personal experience tells me that&#8217;s very much not the case. Is it that women don&#8217;t make good entrepreneurs? Certainly not. Maybe women don&#8217;t want to become public speakers? I don&#8217;t know&#8230; I&#8217;m at a loss to explain this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/06/the-art-of-marketing-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art Of Marketing</title>
		<link>http://www.topdownview.com/2011/06/the-art-of-marketing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-art-of-marketing</link>
		<comments>http://www.topdownview.com/2011/06/the-art-of-marketing/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 11:27:14 +0000</pubDate>
		<dc:creator>Jon Jennings</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[marketing]]></category>

		<guid isPermaLink="false">http://www.topdownview.com/?p=467</guid>
		<description><![CDATA[On Thursday I was lucky enough to attend The Art Of Marketing conference here in Vancouver. Not the sort of conference I usually attend, I&#8217;m usually found at the more technical conferences in town. But take a look at the speaker list: Gary Vaynerchuk, Guy Kawasaki, William Taylor, Mitch Joel and Avinash Kaushik. These guys [...]]]></description>
			<content:encoded><![CDATA[<p>On Thursday I was lucky enough to attend <a href="http://www.theartofmarketing.ca/">The Art Of Marketing</a> conference here in Vancouver.</p>
<p>Not the sort of conference I usually attend, I&#8217;m usually found at the more technical conferences in town. But take a look at the speaker list: <a href="http://www.garyvaynerchuk.com/">Gary Vaynerchuk</a>, <a href="http://www.guykawasaki.com/">Guy Kawasaki</a>, <a href="http://williamctaylor.com/">William Taylor</a>, <a href="http://www.twistimage.com/about-mitch/">Mitch Joel</a> and <a href="http://www.kaushik.net/avinash/about">Avinash Kaushik</a>. These guys are all, every last one of them, giants of the online marketing world. You could easily stage a conference with just one of those speakers as a headliner, plus a handful of relative unknowns, and expect it to be successful.</p>
<p>The speeches themselves were all good&#8230; and some were truly great. Plus the host, <a href="http://web.mac.com/rontite/rontitecomedy/Home.html">Ron Tite</a>, did an excellent job of engaging the audience with a mixture of marketing stories and humour. I&#8217;m not <em>entirely</em> convinced that someone who is already established in the online marketing business would have got their money&#8217;s worth from the information presented &#8211; but I think that can be argued about most conferences. Talking with friends of mine who do this for a living and were at the conference, they generally agreed but suspected that a lot of the audience were either managers or traditional marketing people wanting to break into online. However, regardless of whether or not you already knew the information that&#8217;s been presented, it&#8217;s always useful to have it reinforced. Plus the networking opportunities were also awesome. And, as one of a relatively small number of developers there, a lot of the people I spoke with were interested to hear a different viewpoint on the topics discussed.</p>
<p>I took notes through all five speeches but, given the mesmerizing nature of some of the presentations, the notes are short, bullet-pointed and bearing more than a passing resemblance to a drunken spider&#8217;s journey home from the pub. However, for those of you that couldn&#8217;t make it on Thursday, I&#8217;ll write them up and post them speaker by speaker.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.topdownview.com/2011/06/the-art-of-marketing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

