<?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>I am ShadowLord&#187; ipod touch</title>
	<atom:link href="http://iamshadowlord.com/tag/ipod-touch/feed" rel="self" type="application/rss+xml" />
	<link>http://iamshadowlord.com</link>
	<description>Interesting to me</description>
	<lastBuildDate>Fri, 20 Jan 2012 23:48:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>iTurn &#8211; iPhone and iPod Touch Hack</title>
		<link>http://iamshadowlord.com/2008/12/iturn-iphone-and-ipod-touch-hack.html</link>
		<comments>http://iamshadowlord.com/2008/12/iturn-iphone-and-ipod-touch-hack.html#comments</comments>
		<pubDate>Fri, 26 Dec 2008 07:30:00 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[iobridge]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[servo]]></category>

		<guid isPermaLink="false">http://iamshadowlord.com/?p=18</guid>
		<description><![CDATA[Since my toaster has been on the Internet Twittering my toasting habits, I have been flooded with email asking what I was going to do next. To be fair, most of the email suggested that I had too much time on my hands. My mom got me an iPod Touch for Christmas (she gave it [...]]]></description>
			<content:encoded><![CDATA[<p>Since my <a href="http://www.iamshadowlord.com/2008/12/social-networking-for-my-toaster.html">toaster</a> has been on the Internet <a href="http://www.twitter.com/mytoaster">Twittering</a> my toasting habits, I have been flooded with email asking what I was going to do next. To be fair, most of the email suggested that I had too much time on my hands. My mom got me an iPod Touch for Christmas (she gave it to me a few days early). I have not had the thing out of my sight since she surprised me with a wonderful gift. She also gave me Batman which I transfered to the iPod. I turned the screen about 44 times a minute while watching The Joker and The Dark Knight try to out smart each other. This got me thinking, &#8220;Could I control a motor with the movement of the iPod?&#8221; I had my next hack.</p>
<p>The iPhone or iPod Touch has an accelerometer that detects how the device is oriented. As the devices moves off axis (from straight up and down) the screen rotates. I want to use that feedback to control the position of a motor or servo or cause specific events to happen depending on the device&#8217;s position.</p>
<p>Taking the <a href="http://www.iobridge.com/store">ioBridge IO-204 module</a>, I connected the servo controller and a servo to one of the channels. On the servo I taped a Best Western hotel pen to show the movement of the servo. I found from hours of testing that the Best Western worked the &#8220;Best&#8221; and Hampton Inn worked slightly worse.</p>
<p><a href="http://www.iamshadowlord.com/uploaded_images/iTurn-Setup.jpg"><img style="margin: 0px auto 10px; display: block; width: 400px; height: 317px; text-align: center;" src="http://www.iamshadowlord.com/uploaded_images/iTurn-Setup-706413.jpg" border="0" alt="iTurn setup" /></a></p>
<p>On the ioBridge website, I created 3 widgets that corresponded with the orientation of the iPod. &#8220;Left&#8221; for when tilted towards the left, &#8220;Right&#8221; when I turned right, and &#8220;Forward&#8221; when I was holding the iPod normally (straight up and down).</p>
<p><img style="margin: 0px auto 10px; display: block; width: 145px; height: 90px; text-align: center;" src="http://www.iamshadowlord.com/uploaded_images/iTurn-Screen-756686.jpg" border="0" alt="iTurn Widgets and Screen Shot" /></p>
<p><span style="color: #ff0000;">Warning: The next part involves some light programming.</span> I made a quick HTML file with some JavaScript that detected the orientation of the iPod and called the appropriate widget. The orientation code is below for those of you that are interested in trying this for yourself:</p>
<p><span style="font-family: courier new;"> </span></p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:580px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">function</span> updateOrientation<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">orientation</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">:</span> widgetExecute<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Upright Widget ID&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">90</span><span style="color: #339933;">:</span> widgetExecute<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Right Widget ID&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">90</span><span style="color: #339933;">:</span> widgetExecute<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Left Widget ID&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></div>
<p><span class="Apple-style-span" style="font-family: arial;">Load up the completed HTML file on your iPhone or iPod Touch and now you can control a servo with the turning of your iPhone. I call it &#8220;iTurn&#8221; (didn&#8217;t see that one coming, did you?).</span></p>
<p><span class="Apple-style-span" style="font-family: arial;">Here is a </span><a href="http://www.youtube.com/watch?v=KI8siN6EIZ8"><span class="Apple-style-span" style="font-family: arial;">YouTube video</span></a><span class="Apple-style-span" style="font-family: arial;"> of the iTurn project:</span></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/KI8siN6EIZ8&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/KI8siN6EIZ8&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://iamshadowlord.com/2008/12/iturn-iphone-and-ipod-touch-hack.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

