<?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>Life of Andrew &#187; Computer</title>
	<atom:link href="http://sandfly.net.nz/blog/category/computer/feed/" rel="self" type="application/rss+xml" />
	<link>http://sandfly.net.nz/blog</link>
	<description>Life, technology</description>
	<lastBuildDate>Tue, 15 May 2012 10:48:19 +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>The Seven Realities of Social Networking</title>
		<link>http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-seven-realities-of-social-networking</link>
		<comments>http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/#comments</comments>
		<pubDate>Tue, 08 May 2012 09:36:17 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Culture]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1546</guid>
		<description><![CDATA[Every few months the same complaints about social networking sites appear in the press. Lack of privacy and control over who sees what is a common point of point of editorial hand-wringing. While these concerns are valid, directing them at social networking sites is misplaced, and shows a lack of understanding of the relationship these <a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2012/05/social-media-integration/' rel='bookmark' title='Social Media Integration'>Social Media Integration</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/' rel='bookmark' title='Google+ Social Media Features'>Google+ Social Media Features</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/google/' rel='bookmark' title='Google+'>Google+</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Every few months the same complaints about social networking sites appear in the press. Lack of privacy and control over who sees what is a common point of point of editorial hand-wringing. While these concerns are valid, directing them at social networking sites is misplaced, and shows a lack of understanding of the relationship these sites have with the public.</p>
<p>This post is an attempt to state clearly the realities of the situation. I am using Facebook as an example, not because Facebook is particularly bad, it is merely the most popular. Google Plus, MySpace, and even services like LinkedIn all share the same properties.</p>
<h3>Reality 1: You Do Not Have a Facebook Page</h3>
<p>No really, you don&#8217;t.</p>
<p>Facebook has a page on you. You occasionally log on and add more information to Facebook&#8217;s page about you, but neither the page nor the data is yours. You gave the data to Facebook when you posted it.</p>
<p>This is not a necessarily a bad deal. In return for maintaining Facebook&#8217;s page about yourself, you get a platform to broadcast your doings and to see Facebook&#8217;s pages about your friends and family. I don&#8217;t know about you but I enjoy both these activities and participate willingly.</p>
<h3>Reality 2: You Are Not a Customer of Facebook</h3>
<p>No you aren&#8217;t.</p>
<p>Facebook&#8217;s customers are the advertisers that buy advertising on the site, and the marketers that pay to access to the fantastic demographic data we have all provided. They are paying Facebook for this service, you are not paying anyone for anything.</p>
<p>I know you enjoy using the site as it is, but don&#8217;t get upset when Facebook decides to improve things for itself or its customers. The customer is always right, and you are not a customer. You are the product. Facebook gets paid providing access to you.</p>
<h3>Reality 3: Facebook Owes You Nothing</h3>
<p>They certainly do not.</p>
<p>You may have been a loyal Facebook user, diligently posting photos of your cat and that batch of cupcakes you made last month, but that doesn&#8217;t mean anything to Facebook. </p>
<p>You have, in fact, cost Facebook money. Server farms don&#8217;t grow on trees. </p>
<p>Each time you view a page or update your status, Facebook wears the cost in electricity and CPU time. But don&#8217;t worry, Facebook is willing to bear the burden to provide a better product to its customers. </p>
<h3>Reality 4: Your Privacy is Not Facebook&#8217;s Problem</h3>
<p>If you have uploaded something to Facebook then it is public. That is the whole point of Facebook. Sure there are privacy settings, but they just mean that Facebook makes a small effort not to show things you have marked private to random people. Nothing stops other people from re-posting the photo of you at the Christmas party, or even just printing it out and sticking to your car. If you had wanted it to be private then you wouldn&#8217;t have put it on the Internet.</p>
<p>Likewise, if one of your friends tagged you in a photo that you don&#8217;t want to be associated with (a common source of privacy issues), that is not really Facebook&#8217;s problem either. You have a problem with your friend.</p>
<h3>Reality 5: Nothing is Really Removed From Facebook</h3>
<p>You can check out any time you want, but you can never leave. Removing stuff from Facebook does not guarantee that it will not be accessible. Your data will still exists in uncounted backups, caches, redundant servers and log files. That is not even taking into account the memories of the hundreds of people who might have seen it before you &#8220;deleted&#8221; it. </p>
<p>If you didn&#8217;t want it seen, you shouldn&#8217;t have uploaded it.</p>
<h3>Reality 6: Facebook Is Not Picky About Who It Deals With</h3>
<p>Despite what I have written here, Facebook does at least pay lip service to the illusion of privacy but the same can not be said of the many developers that piggyback on its service to provide apps and games. When Facebook tells you that installing a particular App gives the developer access to your profile, they mean it. You have even less of a relationship with these developers than you do with Facebook. Your trust is a commodity to them, spend it wisely.</p>
<h3>Reality 7: Facebook is Not (Especially) Evil</h3>
<p><img src="http://sandfly.net.nz/blog/wp-content/uploads/2012/05/facebookman.png" alt="A terrible cartoon of the Facebook logo stealing your data" title="Facebook Man" width="104" height="198" class="alignleft size-full wp-image-1547" />Facebook is just a simple company trying to make its way in the universe. By all means, use and enjoy Facebook without concern (perhaps even &#8220;like&#8221; this page). But Facebook is not your friend, and they have their own interests to look after. And besides, they take nothing that you don&#8217;t give them.</p>
<p>Your relationship with social networking sites will be better if you remember that.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2012/05/social-media-integration/' rel='bookmark' title='Social Media Integration'>Social Media Integration</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/' rel='bookmark' title='Google+ Social Media Features'>Google+ Social Media Features</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/google/' rel='bookmark' title='Google+'>Google+</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Social Media Integration</title>
		<link>http://sandfly.net.nz/blog/2012/05/social-media-integration/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=social-media-integration</link>
		<comments>http://sandfly.net.nz/blog/2012/05/social-media-integration/#comments</comments>
		<pubDate>Tue, 01 May 2012 10:55:47 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1532</guid>
		<description><![CDATA[I have decided to try out social media integration on my blog for a while, because I am curious to see which posts people enjoy the most. My previous attempts failed, so now I am keeping it simple. From now on you will see both a Facebook &#8220;like&#8221; button and a Google+ &#8220;+1&#8243; at the <a href='http://sandfly.net.nz/blog/2012/05/social-media-integration/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
<li><a href='http://sandfly.net.nz/blog/2010/08/200th-post-state-of-the-blog-2/' rel='bookmark' title='200th Post &#8211; State of the Blog'>200th Post &#8211; State of the Blog</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have decided to try out social media integration on my blog for a while, because I am curious to see which posts people enjoy the most. My previous attempts failed, so now I am keeping it simple. From now on you will see both a Facebook &#8220;like&#8221; button and a Google+ &#8220;+1&#8243; at the foot of each of my musings.</p>
<p><img src="http://sandfly.net.nz/blog/wp-content/uploads/2012/05/yingyang.png" alt="A logo made by mashing together the facebook and google+ logo" title="facebook google+" width="200" height="198" class="alignleft size-full wp-image-1534" />The Google button is a lot less intrusive than the Facebook solution, hitting +1 is just a small nod of approval. I think the only place it shows up is if you specifically look at your likes on Google+ itself and I am not even sure if other people get to see the things you have +1&#8242;d. The total number of +1s is all anyone sees.</p>
<p>Clicking the Facebook &#8220;like&#8221; button actually posts an item to your Facebook timeline. This is great for me, since your friends see that you like this link and may visit themselves, but you might not like your &#8220;friends&#8221; knowing what you like. It depends on how much you value your privacy. </p>
<p>Incidentally, unless I am your friend on Facebook I don&#8217;t get any special information about who clicked that button. On the G+ side, I don&#8217;t know if you +1&#8242;d me even if I am following you.</p>
<p>So if you like a post, click away. If you don&#8217;t like a post, leave a comment. If you don&#8217;t care, watch some cats playing on YouTube. Everybody wins.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
<li><a href='http://sandfly.net.nz/blog/2010/08/200th-post-state-of-the-blog-2/' rel='bookmark' title='200th Post &#8211; State of the Blog'>200th Post &#8211; State of the Blog</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2012/05/social-media-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jumping Frogs &#8211; Using Python to Solve Puzzles</title>
		<link>http://sandfly.net.nz/blog/2011/11/jumping-frogs-using-python-to-solve-puzzles/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jumping-frogs-using-python-to-solve-puzzles</link>
		<comments>http://sandfly.net.nz/blog/2011/11/jumping-frogs-using-python-to-solve-puzzles/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 10:25:29 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1308</guid>
		<description><![CDATA[A few months ago I came across the following puzzle in a video game I was playing: Three frogs are happily hopping along a narrow board together when they meet another group of three frogs traveling in the opposite direction. These frogs can only move in the direction they are facing, and only if there <a href='http://sandfly.net.nz/blog/2011/11/jumping-frogs-using-python-to-solve-puzzles/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2009/11/python-and-the-very-slow-server/' rel='bookmark' title='Python and The Very Slow Server'>Python and The Very Slow Server</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A few months ago I came across the following puzzle in a video game I was playing:</p>
<p><img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/11/sixfrogs.png" alt="The starting position for the siz frogs puzzle" title="Six frogs on a branch puzzle" width="500" height="63" class="aligncenter size-full wp-image-1312" /><em>Three frogs are happily hopping along a narrow board together when they meet another group of three frogs traveling in the opposite direction. These frogs can only move in the direction they are facing, and only if there is a space directly in front of them. Additionally, a frog can jump over the frog in front but only if there is clear space on the other side to land in. </p>
<p>How can the frogs (moving one at a time) pass each other and continue on their way?</em></p>
<p>Of course, this is a hoary old puzzle that most people come across and solve as children. It should be only a couple of minutes work with a pen and paper to confirm that it is possible to exchange both sets of frogs but I wouldn&#8217;t be much of a programmer if I used a piece of paper where hundreds of dollars of computer equipment would do just as well.</p>
<p>To solve a puzzle like this programatically requires three things: a representation of the current state of the problem, a way of generating every possibly legal move from a given position, and a way of figuring out when is a good time to stop.</p>
<p>Firstly, the representation of the board is a simple python list:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">start = <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>Frogs traveling right or left are represented by &#8220;1&#8243; and &#8220;-1&#8243; respectively. Empty spaces that frog can move into are represented by &#8220;0&#8243;. The advantage of this representation is that you can calculate the new position of a frog by:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">newPos = pos + <span style="color: black;">&#40;</span>representation <span style="color: #66cc66;">*</span> distance<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>where pos is the current index in the array, distance is the size of the hop (either 1 or 2) and representation is either 1 or -1.</p>
<p>Next, we need a way of generating legal moves for a given position:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> legalMoves<span style="color: black;">&#40;</span>board<span style="color: black;">&#41;</span>:
	moves = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> pos, piece <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">enumerate</span><span style="color: black;">&#40;</span> board <span style="color: black;">&#41;</span>:
		jumpmove = pos + <span style="color: black;">&#40;</span>piece <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
		move = pos + <span style="color: black;">&#40;</span>piece<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> piece == <span style="color: #ff4500;">0</span> <span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">continue</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span> jumpmove <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">0</span> <span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span> jumpmove <span style="color: #66cc66;">&gt;</span>= <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>board<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>board<span style="color: black;">&#91;</span>jumpmove<span style="color: black;">&#93;</span> == <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>:
				t = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>board<span style="color: black;">&#41;</span>
				t<span style="color: black;">&#91;</span>pos<span style="color: black;">&#93;</span> = <span style="color: #ff4500;">0</span>
				t<span style="color: black;">&#91;</span>jumpmove<span style="color: black;">&#93;</span> = piece
				moves.<span style="color: black;">append</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>move <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span> move <span style="color: #66cc66;">&gt;</span>= <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>board<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> board<span style="color: black;">&#91;</span>move<span style="color: black;">&#93;</span> == <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>:
				t = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>board<span style="color: black;">&#41;</span>
				t<span style="color: black;">&#91;</span>pos<span style="color: black;">&#93;</span> = <span style="color: #ff4500;">0</span>
				t<span style="color: black;">&#91;</span>move<span style="color: black;">&#93;</span> = piece
				moves.<span style="color: black;">append</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> moves</pre></td></tr></table></div>

<p>Now we need a way of keeping track of all board positions we have seen, so once we find the target we can print the states that led to the solution:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> evalAll<span style="color: black;">&#40;</span> current, target <span style="color: black;">&#41;</span>:
	next = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> a <span style="color: #ff7700;font-weight:bold;">in</span> current:
		n = legalMoves<span style="color: black;">&#40;</span>a<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">for</span> q <span style="color: #ff7700;font-weight:bold;">in</span> n:
			t = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>a<span style="color: black;">&#41;</span>
			t.<span style="color: black;">append</span><span style="color: black;">&#40;</span>q<span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> q == target <span style="color: black;">&#41;</span>:
				<span style="color: #ff7700;font-weight:bold;">return</span> t
			next.<span style="color: black;">append</span><span style="color: black;">&#40;</span>t<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> next</pre></td></tr></table></div>

<p>This code keeps a list of lists, each sublist being it&#8217;s own list of the sequence of moves investigated so far. For each sequence of moves, the next legal moves are discovered and new sequences are added to be investigated the next time this function is called. Technically this is called a <a href="http://en.wikipedia.org/wiki/Breadth-first_search">breadth-first search</a> because at all of the current legal moves are investigated before moving on the next stage. This is a very simplistic way of doing the job, but in this case the puzzle is small enough that it works well enough.</p>
<p>Finally, a simple wrapper that we can use to set things up and return the final result.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> solve<span style="color: black;">&#40;</span>start<span style="color: black;">&#41;</span>:
	temp=<span style="color: black;">&#91;</span><span style="color: black;">&#91;</span>start<span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>
	end = <span style="color: #008000;">list</span><span style="color: black;">&#40;</span>start<span style="color: black;">&#41;</span>
	end.<span style="color: black;">reverse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">while</span><span style="color: black;">&#40;</span>temp<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">!</span>= end<span style="color: black;">&#41;</span>:
		temp = evalAll<span style="color: black;">&#40;</span>temp, end<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> temp</pre></td></tr></table></div>

<p>So now we can do this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">print</span> solve<span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: black;">&#91;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>,
 <span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>Success!</p>
<p>You might say this is a waste of time since you figured out the problem in your head. Good for you, but try this on for size:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">0</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span>, -<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span></pre></td></tr></table></div>

<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2009/11/python-and-the-very-slow-server/' rel='bookmark' title='Python and The Very Slow Server'>Python and The Very Slow Server</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/11/jumping-frogs-using-python-to-solve-puzzles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stuff from my Old Hard Drive</title>
		<link>http://sandfly.net.nz/blog/2011/11/stuff-from-my-old-hard-drive/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=stuff-from-my-old-hard-drive</link>
		<comments>http://sandfly.net.nz/blog/2011/11/stuff-from-my-old-hard-drive/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 10:14:47 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Culture]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[amiga]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1275</guid>
		<description><![CDATA[I don&#8217;t usually keep a lot of files around. When I get a new computer I don&#8217;t tend to copy all my documents across &#8211; anything I haven&#8217;t looked at for a couple of months is probably not worth the fraction of a millimetre it takes up on the platter. On the other hand, some <a href='http://sandfly.net.nz/blog/2011/11/stuff-from-my-old-hard-drive/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2009/01/replacing-a-macbook-hard-drive/' rel='bookmark' title='Replacing a MacBook Hard Drive'>Replacing a MacBook Hard Drive</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t usually keep a lot of files around. When I get a new computer I don&#8217;t tend to copy all my documents across &#8211; anything I haven&#8217;t looked at for a couple of months is probably not worth the fraction of a millimetre it takes up on the platter. On the other hand, some things I can never bring myself to delete. Here is something I rediscovered the other day:</p>
<p>This is one of the first <a href="http://en.wikipedia.org/wiki/Module_file">MODs</a> I wrote back on the Amiga. I never had a sampler or a very large collection of instruments, but I loved mucking around with <a href="http://en.wikipedia.org/wiki/OctaMED">MED</a> trying to get a pleasant sound out of the 4 channel 8-bit sound. It is often said that there is a lot of crossover between programming and music, and the soundtracker clones of the 90s made that explicit which is possibly why I enjoyed it so much. Now days I can fire up GarageBand any time I want with any number of sampled instruments. I could say that I regret not having the time to produce music as an adult but the truth is that the inspiration isn&#8217;t there any more &#8211; my interests have moved in other directions. </p>
<p>Although none of my MODs ever sounded anything like as good as the music from the games and demos of the time, I am still pretty pleased with this one. It must date from form 6 (I was 16) which makes it vintage 1991. Listen to the sound of 20 years ago&#8230;</p>
<div style="margin-left:auto; margin-right:auto; text-align: center; border: solid black 1px;">
<audio controls="controls" style="padding: 15px;"><br />
<source src="http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.ogg" type="audio/ogg"/><br />
<source src="http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.mp3" type="audio/mp3"/><br />
You browser does not support the &lt;audio&gt; tag, but you can still download the music from the links below.<br />
</audio>
</div>
<p><a href='http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.mp3'>Jungle Drums MP3</a><br />
<a href='http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.ogg'>Jungle Drums OGG</a></p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2009/01/replacing-a-macbook-hard-drive/' rel='bookmark' title='Replacing a MacBook Hard Drive'>Replacing a MacBook Hard Drive</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/11/stuff-from-my-old-hard-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.mp3" length="592915" type="audio/mpeg" />
<enclosure url="http://sandfly.net.nz/blog/wp-content/uploads/2011/11/jungle.ogg" length="707459" type="audio/ogg" />
		</item>
		<item>
		<title>Google+ Social Media Features</title>
		<link>http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google_plus_social_media_features</link>
		<comments>http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 09:31:21 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1217</guid>
		<description><![CDATA[Blog writers want feedback. For ages now I have been running a plugin on this blog that allows readers to quickly post things I have written to Twitter, Reddit, Facebook, etc in the hope that some of my wittier and more insightful musings might be widely distributed. The icons were there for years and, as <a href='http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/google/' rel='bookmark' title='Google+'>Google+</a></li>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Blog writers want feedback. For ages now I have been running a plugin on this blog that allows readers to quickly post things I have written to Twitter, Reddit, Facebook, etc in the hope that some of my wittier and more insightful musings might be widely distributed. The icons were there for years and, as far as I can tell, the icons were clicked exactly none times. None.</p>
<p>So I have removed that plugin and am trying something else.</p>
<p><img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/09/plusone.png" alt="" title="Large G+ Icon" width="508" height="199" class="aligncenter size-full wp-image-1218" /></p>
<p>Google+ is Google&#8217;s attempt at social media (<a href="http://sandfly.net.nz/blog/2011/07/google/">previously</a>) and I am liking a lot of what they are doing. It is sort of like a mixture of Twitter and Facebook, you can follow people without them reciprocating and anything you post can be shared with only a subset of people. +1 is Google&#8217;s equivalent of Facebook&#8217;s Like button. </p>
<p>If you are logged into G+ you can click on the +1 button to show you approve of the content and want to see more like it. You can go back through the archives and +1 as many articles as you want &#8211; go ahead, I&#8217;ll wait. </p>
<p>In addition, I have added my Google Plus feed to the sidebar on the right. I am not sure if I will keep this, I post very few updates, but we will see. I quite like having my long form blog posts and my short for G+ updates visible in one place.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/google/' rel='bookmark' title='Google+'>Google+</a></li>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game Review &#8211; GoatUp</title>
		<link>http://sandfly.net.nz/blog/2011/09/game-review-goatup/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=game-review-goatup</link>
		<comments>http://sandfly.net.nz/blog/2011/09/game-review-goatup/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 11:20:31 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Culture]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1207</guid>
		<description><![CDATA[Jeff Minter, with his alter-ego/software company, Llamasoft, has been creating ungulate related games for as long as I can remember. On the Amiga games like Llamatron and Attack of the Mutant Camels were ridiculously over the top arcade perfection, with retro (even then) graphics, lofi sound, and pixel perfect controls. GoatUp is a fine addition <a href='http://sandfly.net.nz/blog/2011/09/game-review-goatup/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2008/05/game-review-star-soldier-r/' rel='bookmark' title='Game Review : Star Soldier R'>Game Review : Star Soldier R</a></li>
<li><a href='http://sandfly.net.nz/blog/2010/07/game-review-citadels/' rel='bookmark' title='Game Review : Citadels'>Game Review : Citadels</a></li>
<li><a href='http://sandfly.net.nz/blog/2008/06/game-review-origins-how-we-became-human/' rel='bookmark' title='Game Review : Origins : How We Became Human'>Game Review : Origins : How We Became Human</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Jeff Minter, with his alter-ego/software company, <a href="http://minotaurproject.co.uk/frontpage.php">Llamasoft</a>, has been creating ungulate related games for as long as I can remember. On the Amiga games like Llamatron and Attack of the Mutant Camels were ridiculously over the top arcade perfection, with retro (even then) graphics, lofi sound, and pixel perfect controls. <a href="http://minotaurproject.co.uk/blog/?p=140">GoatUp</a> is a fine addition to Minter&#8217;s metaphorical stable (as opposed to the real stable he probably owns.)</p>
<p><center><img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/09/20110927-002135.jpg" alt="20110927-002135.jpg" class="aligncentre size-full" /></center></p>
<p>In GoatUp, you control an incredibly nimble and fertile nanny goat who must jump from platform to platform to climb an impossibly tall tower into the sky, picking up bonus items and powerups along the way. Every so often you will meet a billy goat, kissing billy goats gives you more points and also causes you to get pregnant. After a while you instantaneously give birth to a kid that follows you around, if you survive long enough you can get a long chain of offspring trailing behind you. This is useful for defeating enemies, but disturbing if you stop to think about it. Luckily, there is no time to think &#8211; you must always be climbing and the game is hard, hard, hard.</p>
<p>The old games lived by their control schemes and GoatUp provides several. The only one that really works well is moving via tilting left or right, and jumping with a touch. You can tell that some thought has been put into the controls, and they work much better than the tilt controls in other games. Speaking of old games, GoatUp&#8217;s graphics are deliberately designed to look like various games from the 80&#8242;s, some pretty obscure. Part of the fun is trying to remember the particular game that is being invoked.</p>
<p>Recommended if you like this sort of thing.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2008/05/game-review-star-soldier-r/' rel='bookmark' title='Game Review : Star Soldier R'>Game Review : Star Soldier R</a></li>
<li><a href='http://sandfly.net.nz/blog/2010/07/game-review-citadels/' rel='bookmark' title='Game Review : Citadels'>Game Review : Citadels</a></li>
<li><a href='http://sandfly.net.nz/blog/2008/06/game-review-origins-how-we-became-human/' rel='bookmark' title='Game Review : Origins : How We Became Human'>Game Review : Origins : How We Became Human</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/09/game-review-goatup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino Powered Tachistoscope</title>
		<link>http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arduino-powered-tachistoscope</link>
		<comments>http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 22:26:54 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1190</guid>
		<description><![CDATA[About fifteen hundred years ago I wrote WordApp, a Java applet tachistoscope that reads a text file from either the local filesystem or the Internet and displays it one word at a time. The idea is that it trains your brain to recognise words quickly, increasing your reading speed. I thought it was a little <a href='http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/starting-with-arduino/' rel='bookmark' title='Starting with Arduino'>Starting with Arduino</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>About fifteen hundred years ago I wrote <a href="http://sandfly.net.nz/apps/wordup/">WordApp, a Java applet tachistoscope</a> that reads a text file from either the local filesystem or the Internet and displays it one word at a time. The idea is that it trains your brain to recognise words quickly, increasing your reading speed. I thought it was a little silly, but according to me web host&#8217;s logs WordUp still sees a bit of use even though I haven&#8217;t touched it for years.</p>
<p>I was hunting around for something to do with my Arduino while I waited for some other parts to arrive when I had the idea of making a physical tachistoscope that reads its data off an SD card and displays the text using an LCD display I have lying around.<br />
<img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/08/tachistoscope.jpg" alt="" title="Arduino powered tachistoscope" width="450" height="243" class="aligncenter size-full wp-image-1191" /><br />
The SD card contains the text to be shown. One of the potentiometers is used to vary the contrast on the LCD. The other is sampled by the CPU and converted into a delay to vary the speed at which the words appear.</p>
<p>Unfortunately the refresh rate of the LCD is very poor, so the text becomes almost impossible to read at even modest speeds. A better display might help, but I am not going to spend any more time and money on something so simple. Fortunately, the other parts I ordered arrived yesterday so I have other things to play with.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
An Arduino implementation of a Tachistoscope.
This uses both the LiquidCrystal and SD libraries (and repective devices). The 
words are read one at a time from a file on the SD card. A simple variable resistor
is used to control the speed.
In practice this does not work terribly well since the LCD display has a poor
refresh rate.
&nbsp;
Pins: 
The LCD is connected via pins 2-8. Technically I could get away without the RW pin.
The SD card reader is connected via pins 10-13 (the standard SPI pins)
The variable resistor is connected via analog A0
&nbsp;
Author: Andrew Stephens http://sandfly.net.nz/
*/</span>
&nbsp;
<span style="color: #339900;">#include &lt;LiquidCrystal.h&gt;</span>
<span style="color: #339900;">#include &lt;SD.h&gt;</span>
&nbsp;
LiquidCrystal lcd<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">8</span>, <span style="color: #0000dd;">7</span>, <span style="color: #0000dd;">6</span>, <span style="color: #0000dd;">5</span>, <span style="color: #0000dd;">4</span>, <span style="color: #0000dd;">3</span>, <span style="color: #0000dd;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
File file<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> setup<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  lcd.<span style="color: #007788;">begin</span><span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">16</span>, <span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  lcd.<span style="color: #007788;">clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  lcd.<span style="color: #007788;">setCursor</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  pinMode<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">10</span>, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  <span style="color: #666666;">// required if I ever change the CS pin from 10</span>
  pinMode<span style="color: #008000;">&#40;</span>A0, INPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  SD.<span style="color: #007788;">begin</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">10</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  file <span style="color: #000080;">=</span> SD.<span style="color: #007788;">open</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;test.txt&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #666666;">// Skip over whitespace, positions the file position at the start of the next</span>
<span style="color: #666666;">// word</span>
<span style="color: #0000ff;">bool</span> findNextWord<span style="color: #008000;">&#40;</span> File<span style="color: #000040;">&amp;</span> file <span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">int</span> r<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>r <span style="color: #000080;">=</span> file.<span style="color: #007788;">peek</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> <span style="color: #000040;">!</span>isSpace<span style="color: #008000;">&#40;</span>r<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    file.<span style="color: #007788;">read</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>  
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #666666;">// Reads a single word (anything up to the next whitespace character) into</span>
<span style="color: #666666;">// the given buffer</span>
<span style="color: #0000ff;">bool</span> getNextWord<span style="color: #008000;">&#40;</span> File<span style="color: #000040;">&amp;</span> file, <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> buffer, <span style="color: #0000ff;">int</span> bufferSize <span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">int</span> r<span style="color: #008080;">;</span>
  <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>r <span style="color: #000080;">=</span> file.<span style="color: #007788;">read</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">!</span><span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> isSpace<span style="color: #008000;">&#40;</span> r <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #000040;">*</span>buffer <span style="color: #000080;">=</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008080;">;</span>
      <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>bufferSize <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      <span style="color: #000040;">*</span>buffer <span style="color: #000080;">=</span> r<span style="color: #008080;">;</span>
      <span style="color: #000040;">++</span>buffer<span style="color: #008080;">;</span>
      bufferSize<span style="color: #000040;">--</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #000040;">*</span>buffer <span style="color: #000080;">=</span> <span style="color: #FF0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">return</span> <span style="color: #0000ff;">false</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666;">// originally this function did more</span>
<span style="color: #0000ff;">int</span> readResistor<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">return</span> analogRead<span style="color: #008000;">&#40;</span>A0<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #0000ff;">void</span> loop<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">char</span> buffer<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">17</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>findNextWord<span style="color: #008000;">&#40;</span> file <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    getNextWord<span style="color: #008000;">&#40;</span> file, buffer, <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>buffer<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    lcd.<span style="color: #007788;">clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    lcd.<span style="color: #007788;">print</span><span style="color: #008000;">&#40;</span> buffer <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0000ff;">else</span>
  <span style="color: #008000;">&#123;</span>
    lcd.<span style="color: #007788;">clear</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    lcd.<span style="color: #007788;">print</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;--end--&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
  <span style="color: #0000ff;">int</span> v <span style="color: #000080;">=</span> readResistor<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  lcd.<span style="color: #007788;">setCursor</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  lcd.<span style="color: #007788;">print</span><span style="color: #008000;">&#40;</span> v <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  delay<span style="color: #008000;">&#40;</span>v<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>  
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/07/starting-with-arduino/' rel='bookmark' title='Starting with Arduino'>Starting with Arduino</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino POV Device Part II</title>
		<link>http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arduino-pov-device-part-ii</link>
		<comments>http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 11:36:53 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1168</guid>
		<description><![CDATA[Last week I wrote about starting with digital electronics with the Arduino prototyping platform. Getting something working was easy enough but I was dissatisfied with ugly result, especially when my friend Lloyd showed up with his extremely tidy version of the same idea. The piece of cardboard had to go! My first version used a <a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/starting-with-arduino/' rel='bookmark' title='Starting with Arduino'>Starting with Arduino</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/' rel='bookmark' title='Arduino Powered Tachistoscope'>Arduino Powered Tachistoscope</a></li>
<li><a href='http://sandfly.net.nz/blog/2009/01/the-c-boost-libraries-part-2-boostassign/' rel='bookmark' title='The C++ Boost Libraries (Part 2 &#8211; boost::assign)'>The C++ Boost Libraries (Part 2 &#8211; boost::assign)</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Last week I <a href="http://sandfly.net.nz/blog/2011/07/starting-with-arduino/">wrote</a> about starting with digital electronics with the Arduino prototyping platform. Getting something working was easy enough but I was dissatisfied with ugly result, especially when my friend Lloyd showed up with his extremely tidy version of the same idea. The piece of cardboard had to go!</p>
<p>My first version used a breadboard and uncut LED leads because I thought that I would want to dismantle the components for reuse. However I have since realised that I am a grown man with a career and can easily afford the $4.50 material cost. Behold POV version 2:</p>
<p><img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/07/front.jpg" alt="" title="The front of my stripboard POV device" width="400" height="236" class="aligncenter size-full wp-image-1170" /><br />
<img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/07/back.jpg" alt="" title="The back of the stripboard, showing some shoddy soldering" width="400" height="236" class="aligncenter size-full wp-image-1171" /><br />
I won&#8217;t be entering this in any soldering competitions but it works OK.</p>
<p>The code has also changed. Compiling in what amounts to a 2D bitmap was a quick way to get something up and running but it wasn&#8217;t very flexible, especially since in the future I want to display long strings of text. This means storing glyphs (letter shapes) for every letter of the alphabet (plus digits and symbols) &#8211; what I needed was a proper font; what I got was this:<br />
<img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/07/font.png" alt="" title="A simple bitmap font" width="418" height="18" class="aligncenter size-full wp-image-1172" /></p>
<p>I then turned to Python to generate the program data to embed in the new Arduino code. This script slices the image vertically, generating one byte (actually only 7 bits) for each slice of pixels. What comes out is a long list of byte values that can be output directly to the Arduino&#8217;s IO pins to display each section of the text, along with a set of indexes that map letters to the start and end positions of individual glyphs in the array.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> GetSlice<span style="color: black;">&#40;</span>i, pos<span style="color: black;">&#41;</span>:
	t = <span style="color: #ff4500;">0</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> q <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span> pos, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> / <span style="color: #ff4500;">7</span> <span style="color: black;">&#41;</span>:
		t = t <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">2</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> i<span style="color: black;">&#91;</span>q<span style="color: black;">&#93;</span> <span style="color: #66cc66;">!</span>= <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\x</span>00'</span> <span style="color: black;">&#41;</span>:
			t = t + <span style="color: #ff4500;">1</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> t
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> GetGlyph<span style="color: black;">&#40;</span> i, pos <span style="color: black;">&#41;</span>:
	end = pos
	start = pos
	data = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: black;">&#40;</span>end <span style="color: #66cc66;">&lt;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span>:
		t = GetSlice<span style="color: black;">&#40;</span> i, end <span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> t == <span style="color: #ff4500;">0</span> <span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">break</span><span style="color: #66cc66;">;</span>
		data.<span style="color: black;">append</span><span style="color: black;">&#40;</span> t <span style="color: black;">&#41;</span>
		end = end + <span style="color: #ff4500;">1</span>
	<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#40;</span>start, end, data<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> GetFont<span style="color: black;">&#40;</span> d <span style="color: black;">&#41;</span>:
    result = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    i = <span style="color: #ff4500;">0</span>
    currentIndex = <span style="color: #ff4500;">0</span>
    indices = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: black;">&#40;</span> i <span style="color: #66cc66;">&lt;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>d<span style="color: black;">&#41;</span> / <span style="color: #ff4500;">7</span> <span style="color: black;">&#41;</span>:
	<span style="color: black;">&#40;</span>start, end, data<span style="color: black;">&#41;</span> = GetGlyph<span style="color: black;">&#40;</span> d, i <span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span> == <span style="color: #ff4500;">0</span> <span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">break</span>
	i = end + <span style="color: #ff4500;">1</span>
	indices.<span style="color: black;">append</span><span style="color: black;">&#40;</span> currentIndex <span style="color: black;">&#41;</span>
	currentIndex = currentIndex + <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
	result.<span style="color: black;">extend</span><span style="color: black;">&#40;</span> data <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#40;</span> result, indices <span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span> <span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff4500;">3</span> <span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;USAGE: program &lt;input&gt; &lt;output&gt;&quot;</span>
        exit<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    data = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    i = <span style="color: #008000;">file</span><span style="color: black;">&#40;</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;rb&quot;</span> <span style="color: black;">&#41;</span>
    data = i.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    i.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: black;">&#40;</span> d, indices <span style="color: black;">&#41;</span> = GetFont<span style="color: black;">&#40;</span> data <span style="color: black;">&#41;</span>
    o = <span style="color: #008000;">file</span><span style="color: black;">&#40;</span> <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;w&quot;</span> <span style="color: black;">&#41;</span>
    o.<span style="color: black;">write</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;static const int indices[] = { &quot;</span> + <span style="color: #483d8b;">&quot;,&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span>, indices <span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot; }; &quot;</span><span style="color: black;">&#41;</span>
    o.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
    o.<span style="color: black;">write</span><span style="color: black;">&#40;</span> <span style="color: #483d8b;">&quot;static const unsigned char fontdata[] = { &quot;</span> + <span style="color: #483d8b;">&quot;,&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span>, d<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;};&quot;</span><span style="color: black;">&#41;</span>
    o.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
    o.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>This scheme is more complex that the original bitmap but allows arbitrary text to be display without lots of editing. The modified Arduino code now looks like this. The first two lines contain the new font data, and you can see that the text to display is simply declared on line 5.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">int</span> indices<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000dd;">0</span>,<span style="color: #0000dd;">4</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">12</span>,<span style="color: #0000dd;">16</span>,<span style="color: #0000dd;">19</span>,<span style="color: #0000dd;">22</span>,<span style="color: #0000dd;">26</span>,<span style="color: #0000dd;">30</span>,<span style="color: #0000dd;">33</span>,<span style="color: #0000dd;">37</span>,<span style="color: #0000dd;">42</span>,<span style="color: #0000dd;">45</span>,<span style="color: #0000dd;">52</span>,<span style="color: #0000dd;">59</span>,<span style="color: #0000dd;">63</span>,<span style="color: #0000dd;">67</span>,<span style="color: #0000dd;">71</span>,<span style="color: #0000dd;">75</span>,<span style="color: #0000dd;">79</span>,<span style="color: #0000dd;">82</span>,<span style="color: #0000dd;">86</span>,<span style="color: #0000dd;">91</span>,<span style="color: #0000dd;">96</span>,<span style="color: #0000dd;">101</span>,<span style="color: #0000dd;">106</span>,<span style="color: #0000dd;">111</span>,<span style="color: #0000dd;">116</span>,<span style="color: #0000dd;">121</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">131</span>,<span style="color: #0000dd;">136</span>,<span style="color: #0000dd;">141</span>,<span style="color: #0000dd;">146</span>,<span style="color: #0000dd;">151</span>,<span style="color: #0000dd;">156</span>,<span style="color: #0000dd;">161</span>,<span style="color: #0000dd;">163</span>,<span style="color: #0000dd;">165</span>,<span style="color: #0000dd;">167</span> <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span> 
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">char</span> fontdata<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000dd;">63</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">63</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">34</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">69</span>,<span style="color: #0000dd;">39</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">2</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">20</span>,<span style="color: #0000dd;">34</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">63</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">60</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">63</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">32</span>,<span style="color: #0000dd;">16</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">4</span>,<span style="color: #0000dd;">2</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">48</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">71</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">76</span>,<span style="color: #0000dd;">51</span>,<span style="color: #0000dd;">50</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">38</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">64</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">112</span>,<span style="color: #0000dd;">12</span>,<span style="color: #0000dd;">3</span>,<span style="color: #0000dd;">12</span>,<span style="color: #0000dd;">112</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">15</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">126</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">96</span>,<span style="color: #0000dd;">16</span>,<span style="color: #0000dd;">15</span>,<span style="color: #0000dd;">16</span>,<span style="color: #0000dd;">96</span>,<span style="color: #0000dd;">67</span>,<span style="color: #0000dd;">69</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">81</span>,<span style="color: #0000dd;">97</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">69</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">81</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">17</span>,<span style="color: #0000dd;">33</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">1</span>,<span style="color: #0000dd;">71</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">49</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">24</span>,<span style="color: #0000dd;">40</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">127</span>,<span style="color: #0000dd;">8</span>,<span style="color: #0000dd;">121</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">6</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">6</span>,<span style="color: #0000dd;">65</span>,<span style="color: #0000dd;">66</span>,<span style="color: #0000dd;">68</span>,<span style="color: #0000dd;">72</span>,<span style="color: #0000dd;">112</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">54</span>,<span style="color: #0000dd;">48</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">73</span>,<span style="color: #0000dd;">62</span>,<span style="color: #0000dd;">3</span>,<span style="color: #0000dd;">3</span>,<span style="color: #0000dd;">123</span>,<span style="color: #0000dd;">123</span>,<span style="color: #0000dd;">27</span>,<span style="color: #0000dd;">27</span>,<span style="color: #0000dd;">127</span><span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> outputPins<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000dd;">12</span>, <span style="color: #0000dd;">11</span>, <span style="color: #0000dd;">10</span>, <span style="color: #0000dd;">9</span>, <span style="color: #0000dd;">8</span>, <span style="color: #0000dd;">7</span>, <span style="color: #0000dd;">6</span> <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">char</span> text<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #FF0000;">&quot;ANDREW&quot;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">void</span> setup<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">6</span><span style="color: #008080;">;</span> i<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">12</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    pinMode<span style="color: #008000;">&#40;</span>i, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>     
    digitalWrite<span style="color: #008000;">&#40;</span>i, HIGH<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
  pinMode<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">13</span>, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  digitalWrite<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">13</span>, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  delay<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">2000</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> loop<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  byte row <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
  byte endRow <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> currentChar <span style="color: #000080;">=</span> text<span style="color: #008080;">;</span>
&nbsp;
  <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span>currentChar <span style="color: #000080;">==</span> <span style="color: #0000dd;">0</span><span style="color: #008000;">&#41;</span>
      currentChar <span style="color: #000080;">=</span> text<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span> row <span style="color: #000080;">==</span> endRow <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">char</span> t <span style="color: #000080;">=</span> <span style="color: #000040;">*</span>currentChar<span style="color: #008080;">;</span>
        currentChar<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
        t <span style="color: #000080;">=</span> t <span style="color: #000040;">-</span> <span style="color: #FF0000;">'A'</span><span style="color: #008080;">;</span>
        row <span style="color: #000080;">=</span> indices<span style="color: #008000;">&#91;</span>t<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
        endRow <span style="color: #000080;">=</span> indices<span style="color: #008000;">&#91;</span>t<span style="color: #000040;">+</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span>row <span style="color: #000040;">!</span><span style="color: #000080;">=</span> endRow<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      byte mask <span style="color: #000080;">=</span> <span style="color: #0000dd;">64</span><span style="color: #008080;">;</span>
      <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>byte pin <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> pin <span style="color: #000080;">&lt;</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#41;</span> <span style="color: #000040;">/</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>outputPins<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>pin <span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        digitalWrite<span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#91;</span>pin<span style="color: #008000;">&#93;</span>, <span style="color: #008000;">&#40;</span>fontdata<span style="color: #008000;">&#91;</span>row<span style="color: #008000;">&#93;</span><span style="color: #000040;">&amp;</span>mask<span style="color: #008000;">&#41;</span><span style="color: #008080;">?</span> HIGH <span style="color: #008080;">:</span> LOW  <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        mask <span style="color: #000080;">=</span> mask <span style="color: #000040;">/</span> <span style="color: #0000dd;">2</span><span style="color: #008080;">;</span> <span style="color: #666666;">// divide mask by two, moving it down one bit</span>
      <span style="color: #008000;">&#125;</span>
      row<span style="color: #000040;">++</span><span style="color: #008080;">;</span>
      delay<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>byte pin <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> pin <span style="color: #000080;">&lt;</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#41;</span> <span style="color: #000040;">/</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>outputPins<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>pin <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
      digitalWrite<span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#91;</span>pin<span style="color: #008000;">&#93;</span>, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    delay<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Still to do:</strong> This code is not very efficient. It uses digitalWrite() in a loop to turn on the LEDs. digitalWrite() is very easy to use but if you look at the source code you will see it does all sorts of unnecessary stuff for this job. I plan to replace it with direct writes to the required Arduino IO registers.</p>
<p>I also want to make the whole thing interrupt driven to free up the CPU. Why would I want the extra CPU time? I have plans for that as well&#8230;</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/starting-with-arduino/' rel='bookmark' title='Starting with Arduino'>Starting with Arduino</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/' rel='bookmark' title='Arduino Powered Tachistoscope'>Arduino Powered Tachistoscope</a></li>
<li><a href='http://sandfly.net.nz/blog/2009/01/the-c-boost-libraries-part-2-boostassign/' rel='bookmark' title='The C++ Boost Libraries (Part 2 &#8211; boost::assign)'>The C++ Boost Libraries (Part 2 &#8211; boost::assign)</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting with Arduino</title>
		<link>http://sandfly.net.nz/blog/2011/07/starting-with-arduino/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=starting-with-arduino</link>
		<comments>http://sandfly.net.nz/blog/2011/07/starting-with-arduino/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 12:18:58 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[my projects]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[nerd]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1161</guid>
		<description><![CDATA[I have a new hobby &#8211; digital electronics! Last week I bought an Arduino Uno on a whim from JayCar. Being a typical programmer, I have very little idea how computers actually work on the physical level so this gives me an easy introduction to lower-level coding and electronics in general. The Arduino is a <a href='http://sandfly.net.nz/blog/2011/07/starting-with-arduino/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/' rel='bookmark' title='Arduino Powered Tachistoscope'>Arduino Powered Tachistoscope</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have a new hobby &#8211; digital electronics! Last week I bought an <a href="http://arduino.cc/">Arduino Uno</a> on a whim from JayCar. Being a typical programmer, I have very little idea how computers actually work on the physical level so this gives me an easy introduction to lower-level coding and electronics in general.</p>
<p>The Arduino is a small board with a fairly capable 8 bit microprocessor (an ATmega328 to be precise) with the IO pins hooked up to convenient headers ready for attaching external devices. The CPU has its own RAM and programmable flash memory, and it comes with a bootloader that can reprogram the flash via the handy USB connection (which can also power the whole board). It is hard to imagine a more plug-n-play device.</p>
<p>I decided that I would follow the well-worn path and create a persistence of vision device for my first project. Mine consists of 7 LEDs hooked up to IO 7 pins (via appropriate resistors), the idea is to make the LEDs blink in such a way that recognisable shapes appear as the LEDs are waved quickly in front of your eyes.<br />
<img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/07/pov.jpg" alt="" title="Arduino-based POV device" width="450" height="205" class="aligncenter size-full wp-image-1164" /><br />
My prototype is a little rough, but works fine in a darkened room (I was too cheap to spring for super bright LEDs and the darkness hides my shoddy soldering job.) The breadboard is too fragile to wave around so the LEDs are mounted on cardboard and connected using a couple of metres of CAT5, which conveniently has 8 internal wires to supply the 7 LEDs with a common ground. The total cost is less than $10, excluding the breadboard and the Arduino itself.<br />
<img src="http://sandfly.net.nz/blog/wp-content/uploads/2011/07/povtext.jpg" alt="" title="POV text displayed in the air" width="400" height="417" class="aligncenter size-full wp-image-1165" /><br />
The Arduino programming environment is pretty nifty. The language used is a limited form of C++ (no standard library or runtime support for much of anything) with some extra libraries for managing the CPU&#8217;s features. Compiling and flashing the CPU is as simple as pushing a button. Here is the code that generated the above picture:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">// Array holding the graphic to display</span>
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> text<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span>
<span style="color: #FF0000;">&quot; XX   X     X  XX     XXXX   XXXX  X     X     &quot;</span>,
<span style="color: #FF0000;">&quot;X  X  XX    X  X  X   X   X  X     X     X     &quot;</span>,
<span style="color: #FF0000;">&quot;X  X  X X   X  X   X  X   X  X     X     X     &quot;</span>,
<span style="color: #FF0000;">&quot;XXXX  X  X  X  X   X  XXXX   XXX   X  X  X     &quot;</span>,
<span style="color: #FF0000;">&quot;X  X  X   X X  X   X  X X    X     X  X  X     &quot;</span>,
<span style="color: #FF0000;">&quot;X  X  X    XX  X  X   X  X   X     X  X  X     &quot;</span>,
<span style="color: #FF0000;">&quot;X  X  X     X  XXX    X   X  XXXX   XX XX      &quot;</span> <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> outputPins<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span> <span style="color: #0000dd;">12</span>, <span style="color: #0000dd;">11</span>, <span style="color: #0000dd;">10</span>, <span style="color: #0000dd;">9</span>, <span style="color: #0000dd;">8</span>, <span style="color: #0000dd;">7</span>, <span style="color: #0000dd;">6</span> <span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">int</span> graphicLength<span style="color: #008080;">;</span>
&nbsp;
&nbsp;
<span style="color: #0000ff;">void</span> setup<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #666666;">// setup the initial state of the pins</span>
  <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">6</span><span style="color: #008080;">;</span> i<span style="color: #000080;">&lt;=</span><span style="color: #0000dd;">12</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    pinMode<span style="color: #008000;">&#40;</span>i, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>     
  <span style="color: #008000;">&#125;</span>
	<span style="color: #666666;">// pin 13 is hardwired to the onboard LED, turn it off</span>
  pinMode<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">13</span>, OUTPUT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  digitalWrite<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">13</span>, LOW<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
  graphicLength <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
  <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> t <span style="color: #000080;">=</span> text<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span> <span style="color: #000040;">*</span>t<span style="color: #000040;">!</span><span style="color: #000080;">=</span><span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>t<span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #000040;">++</span>graphicLength<span style="color: #008080;">;</span>
  <span style="color: #008000;">&#125;</span>  
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> loop<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
  <span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> graphicLength<span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i <span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
		<span style="color: #666666;">// find out if the pin is supposed to be on (HIGH) or off (LOW)</span>
      <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> pin <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> pin <span style="color: #000080;">&lt;</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#41;</span> <span style="color: #000040;">/</span> <span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>outputPins<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>pin <span style="color: #008000;">&#41;</span>
      <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>text<span style="color: #008000;">&#91;</span>pin<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">==</span> <span style="color: #FF0000;">' '</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
          digitalWrite<span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#91;</span>pin<span style="color: #008000;">&#93;</span>, LOW <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0000ff;">else</span>
        <span style="color: #008000;">&#123;</span>
          digitalWrite<span style="color: #008000;">&#40;</span> outputPins<span style="color: #008000;">&#91;</span>pin<span style="color: #008000;">&#93;</span>, HIGH <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
      <span style="color: #008000;">&#125;</span>
      delay<span style="color: #008000;">&#40;</span> <span style="color: #0000dd;">1</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Not very efficient but simple enough to get going. I am already working on a more functional version which will have its own font and interrupt driven display.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/07/arduino-pov-device-part-ii/' rel='bookmark' title='Arduino POV Device Part II'>Arduino POV Device Part II</a></li>
<li><a href='http://sandfly.net.nz/blog/2011/08/arduino-powered-tachistoscope/' rel='bookmark' title='Arduino Powered Tachistoscope'>Arduino Powered Tachistoscope</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/07/starting-with-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google+</title>
		<link>http://sandfly.net.nz/blog/2011/07/google/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google</link>
		<comments>http://sandfly.net.nz/blog/2011/07/google/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 11:34:20 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Culture]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://sandfly.net.nz/blog/?p=1150</guid>
		<description><![CDATA[Why yes, I do have a Google+ account. Why do you ask? Actually, it is no big thing any more. Google are slowly allowing more people on as they ramp up their Facebook-beating service. I have been using it for a day now, and I like a lot of what I see. Unfortunately, the rest <a href='http://sandfly.net.nz/blog/2011/07/google/' class='excerpt-more'>[...]</a>
Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/' rel='bookmark' title='Google+ Social Media Features'>Google+ Social Media Features</a></li>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
<li><a href='http://sandfly.net.nz/blog/2008/09/chrome/' rel='bookmark' title='Chrome'>Chrome</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Why yes, I do have a <a href="https://plus.google.com/110161091350034342335">Google+ account</a>. Why do you ask?</p>
<p>Actually, it is no big thing any more. Google are slowly allowing more people on as they ramp up their Facebook-beating service. I have been using it for a day now, and I like a lot of what I see. Unfortunately, the rest of what I see sort of mystifies me instead.</p>
<p><a href="http://www.google.com/intl/en/+/learnmore/">Google+</a> is a Facebook-like service, where people publish Facebook-like status updates to Facebook-like lists of friends, maybe attaching a link or a photo kind of like you do in another social media website whose name has temporarily slipped my mind. Basically, it&#8217;s Facebook with a slightly more up-to-date look.</p>
<p>Google+&#8217;s main UI difference is the concept of circles. These allow you to easily group your contacts (friends, workmates, family, etc) with a snazzy drag-and-drop interface. Then you can pick which circles get to see each thing you post. It is a lot easier to use than Facebook&#8217;s group concept and more offers more granularity without being to complex.</p>
<p>It is early days yet, but there are things that Facebook still does better. Posting a link is nowhere near is easy &#8211; Facebook allows you to easily customise the summary it displays where Google+ only allows you to delete the summary, not replace it with your own. Notifications are also slow to arrive, but Google+ does display notifications in the other Google apps (gmail, reader) which is very handy.</p>
<p>One thing I was disappointed not to see what any way to link content from other sites into my Google+ stream. For instance, there is no way to automatically post links to new articles on this blog to my Google+ stream. Facebook sort of allows this with its Notes feature. I don&#8217;t use Twitter, but that doesn&#8217;t seem to be included either. Google has Friend Connect for following blogs, but that doesn&#8217;t seem to be integrated into Google+ at all. It is all very strange.</p>
<p>I haven&#8217;t tried the Hangout feature since I don&#8217;t have a webcam on my main computer, but it looks like it could be useful if it works as advertised. The Sparks feature (similar to Google news but not limited to current events) seem great, but doesn&#8217;t really need to be part of Google+. It would be better as a widget on the homepage.</p>
<p>Social Media only gets it&#8217;s usefulness from the number of people who use it regularly. Even if Google+ was as good as Facebook (which it may be soon), there is very little point in anyone maintaining two accounts across different services. Facebook got big because it was a grown-up MySpace, Google+ may be trying for a grown-up Facebook, but Facebook hasn&#8217;t annoyed its users like MySpace did (yet). I can&#8217;t see a mass migration from Facebook to Google+ happening soon unless Google has a few more cards up its sleeve.</p>
<p>Related posts:<ol>
<li><a href='http://sandfly.net.nz/blog/2011/09/google_plus_social_media_features/' rel='bookmark' title='Google+ Social Media Features'>Google+ Social Media Features</a></li>
<li><a href='http://sandfly.net.nz/blog/2012/05/the-seven-realities-of-social-networking/' rel='bookmark' title='The Seven Realities of Social Networking'>The Seven Realities of Social Networking</a></li>
<li><a href='http://sandfly.net.nz/blog/2008/09/chrome/' rel='bookmark' title='Chrome'>Chrome</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://sandfly.net.nz/blog/2011/07/google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

