<?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>ioBridge Blog &#187; Source Code</title>
	<atom:link href="http://blog.iobridge.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.iobridge.com</link>
	<description>News and Projects from the ioBridge Community</description>
	<lastBuildDate>Wed, 18 Jan 2012 06:04:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Execute Widgets with Change in Screen Orientation</title>
		<link>http://blog.iobridge.com/2008/12/execute-widgets-with-change-in-screen-orientation/</link>
		<comments>http://blog.iobridge.com/2008/12/execute-widgets-with-change-in-screen-orientation/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 15:09:18 +0000</pubDate>
		<dc:creator>hans</dc:creator>
				<category><![CDATA[Source Code]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[iturn]]></category>
		<category><![CDATA[servo]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.iobridge.net/projects/?p=120</guid>
		<description><![CDATA[The iPod Touch and iPhone have an accelerometer that adjusts the screen orientation (among other things). You can tap into the orientation and execute widgets depending on the orientation of the device by using a simple HTML file with some Javascript. Put an HTML file on a web server that you can get to on [...]]]></description>
			<content:encoded><![CDATA[<p>The iPod Touch and iPhone have an accelerometer that adjusts the screen orientation (among other things). You can tap into the orientation and execute widgets depending on the orientation of the device by using a simple HTML file with some Javascript. Put an HTML file on a web server that you can get to on your iPod Touch or iPhone.</p>
<p>Part of the Apple Web Kit is the command &#8220;onorientationchange&#8221;. We will use that to detect the orientation change and call a script called &#8220;updateOrientation()&#8221;.</p>
<p>Add the following command to the BODY tag:</p>
<p><code lang="javascript">onorientationchange="updateOrientation();"</code></p>
<p>Place the following function in the HEAD of the document and call certain widgets at the specific orientation angles of 0°, -90°, and 90°. You can call any type of widget adjusting the position of a servo, controlling a digital output, or setting the state of an X10 widget.</p>
<p><code lang="javascript">function updateOrientation(){<br />
switch(window.orientation){<br />
case 0: widgetExecute("Upright Widget ID");<br />
break;<br />
case -90: widgetExecute("Right Widget ID");<br />
break;<br />
case 90: widgetExecute("Left Widget ID");<br />
break;<br />
}<br />
}<br />
</code></p>
<p>Place the widgets referenced in the BODY of the document.</p>
<p><strong>UPDATE:</strong></p>
<p>The full iTurn web app is on the <a href="http://www.iobridge.net/wiki/projects/iturn">Wiki</a>:</p>
<p><a href="http://www.iobridge.net/wiki/projects/iturn">http://www.iobridge.net/wiki/projects/iturn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.iobridge.com/2008/12/execute-widgets-with-change-in-screen-orientation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 4/12 queries in 0.003 seconds using disk: basic
Object Caching 357/380 objects using disk: basic

Served from: blog.iobridge.com @ 2012-02-07 18:05:18 -->
