<?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>Curltable - development blog &#187; potentiometer</title>
	<atom:link href="http://curltable.the-yard.net/tag/potentiometer/feed" rel="self" type="application/rss+xml" />
	<link>http://curltable.the-yard.net</link>
	<description>A snapshot of my projects.</description>
	<lastBuildDate>Mon, 26 Sep 2011 20:34:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use a potentiometer in XNA</title>
		<link>http://curltable.the-yard.net/curltable/use-a-potentiometer-in-xna</link>
		<comments>http://curltable.the-yard.net/curltable/use-a-potentiometer-in-xna#comments</comments>
		<pubDate>Sat, 12 Dec 2009 15:13:33 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Curltable]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[potentiometer]]></category>
		<category><![CDATA[readExisting]]></category>
		<category><![CDATA[readLine]]></category>
		<category><![CDATA[serialPort]]></category>

		<guid isPermaLink="false">http://curltable.the-yard.net/?p=186</guid>
		<description><![CDATA[During my first researches on the curltable I thought it would be nice to have some functions controlled by external elements such as potentiometers, buttons or sliders. So I gave it a try and used my Arduino and the serialPort class for communication to the board. What I tried was to control the tempo of [...]]]></description>
			<content:encoded><![CDATA[<p>During my first researches on the <a href="http://curltable.the-yard.net/curltable/the-curltable">curltable</a> I thought it would be nice to have some functions controlled by external elements such as potentiometers, buttons or sliders. So I gave it a try and used my Arduino and the <a href="http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx">serialPort</a> class for communication to the board. What I tried was to control the tempo of an audio track by a potentiometer.<span id="more-186"></span> Normally a <a href="http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.readline.aspx">SerialPort.readline()</a> should be enough to get the right data from the desired Port but in this case I tried to integrate it into XNA. The problem here is that your game can either run with a <a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.isfixedtimestep.aspx">fixed</a> or a variable timestep. If you are using a variable timestep in XNA the readline method should work for you, if not it will hang because of timing issues. To get around that I used the <a href="http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.readexisting.aspx">SerialPort.ReadExisting()</a> method instead. This one is reading the date without any timeout. Different then the readline method you need to seperate your incoming information from binary data such as &#8216;\n&#8217; (newline) and &#8216;\r&#8217; (carriage return) on your own. Also sometimes the information you get from this method are incorrect or incomplete. So you need to check that too. I set up a little example which can be downloaded from <a href="http://curltable.the-yard.net/files/2009/12/xnaPotentiometer.rar">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://curltable.the-yard.net/curltable/use-a-potentiometer-in-xna/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

