<?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>Limina.Log &#187; Physical Computing</title>
	<atom:link href="http://log.liminastudio.com/category/itp/physical-computing/feed" rel="self" type="application/rss+xml" />
	<link>http://log.liminastudio.com</link>
	<description>The Limina.Studio weblog: Art, Design and Development</description>
	<lastBuildDate>Wed, 08 Sep 2010 00:02:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Measuring XBee signal strength from the RSSI pin</title>
		<link>http://log.liminastudio.com/itp/physical-computing/measuring-xbee-signal-strength-from-the-rssi-pin</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/measuring-xbee-signal-strength-from-the-rssi-pin#comments</comments>
		<pubDate>Thu, 08 Apr 2010 01:52:24 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Thesis]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Microcontroller]]></category>
		<category><![CDATA[xbee]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=577</guid>
		<description><![CDATA[In my thesis I wanted to read the signal strength of incoming packets and store it in a variable on a microcontroller without using the XBee&#8217;s API mode.  XBee modules have an RSSI (Received Signal Strength Indicator) pin that outputs a PWM signal representing this value.  But how do you turn that PWM duty cycle [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://log.liminastudio.com/itp/the-dawn-chorus">thesis</a> I wanted to read the signal strength of incoming packets and store it in a variable on a microcontroller without using the XBee&#8217;s API mode.  XBee modules have an RSSI (Received Signal Strength Indicator) pin that outputs a PWM signal representing this value.  But how do you turn that PWM duty cycle into a useable integer on your microcontroller?  Luckily Arduino has a function made for just this application: <a href="file:///Applications/Arduino.app/Contents/Resources/Java/reference/PulseIn.html">pulseIn</a>.</p>
<ol>
<li>Connect the RSSI pin (pin 6) to a digital pin on your microcontroller.</li>
<li>Use this line of code in your Arduino loop:
<pre>rssiDur = pulseIn(digitalPin, LOW, 200);</pre>
</li>
</ol>
<p>pulseIn returns the duration of a pulse (specified HIGH or LOW) in microseconds (µs).  The 200 is a timeout value in µs—it waits this long to see if there&#8217;s going to be a pulse.  Since the XBee&#8217;s RSSI PWM period is 200µs, we want to wait at most that long to see if there&#8217;s a pulse at all.</p>
<p>Since this function gives you a duration, it&#8217;s up to you to map that to a value relevant to your program.  Since the maximum duration of the pulse would be 200µs, you could map that to your logical maximum.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/measuring-xbee-signal-strength-from-the-rssi-pin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>EggBeater!</title>
		<link>http://log.liminastudio.com/itp/eggbeater</link>
		<comments>http://log.liminastudio.com/itp/eggbeater#comments</comments>
		<pubDate>Tue, 28 Apr 2009 03:51:11 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Dataflow Programming]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[PureData]]></category>
		<category><![CDATA[Sound]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=253</guid>
		<description><![CDATA[EggBeater uses the intuitive power of rhythm to let anyone control the playback of music. Shaking this small, wireless device in regular patterns can automatically adjust the tempo and timing of loops. Just start playing the EggBeater just as you would a traditional shaker, and listen as the song slows down as you slow down, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://log.liminastudio.com/wp-content/uploads/2009/04/eggbeater_image.jpg"  rel="lightbox[roadtrip]"><img class="alignleft size-medium wp-image-350" title="EggBeater" src="http://log.liminastudio.com/wp-content/uploads/2009/04/eggbeater_image-300x188.jpg" alt="EggBeater" width="300" height="188" /></a></p>
<p>EggBeater uses the intuitive power of rhythm to let anyone control the playback of music. Shaking this small, wireless device in regular patterns can automatically adjust the tempo and timing of loops. Just start playing the EggBeater just as you would a traditional shaker, and listen as the song slows down as you slow down, or speed up as you do!</p>
<p>EggBeater uses an accelerometer coupled with an XBee radio to send your movements to PureData, where they detect your downbeats and rhythmic tempo. The software can then control playback within PureData or send OSC or MIDI messages to other platforms.</p>
<p>Here&#8217;s a short video courtesy of Lee-Sean:</p>
<p><object width="400" height="300" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" type="application/x-shockwave-flash"><param name="flashvars" value="intl_lang=en-us&amp;photo_secret=8155cbafd3&amp;photo_id=3521282618&amp;flickr_show_info_box=true" /><param name="bgcolor" value="#000000" /><param name="allowFullScreen" value="true" /><param name="src" value="http://www.flickr.com/apps/video/stewart.swf?v=71377" /><param name="allowfullscreen" value="true" /></object></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/eggbeater/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Prototyping &#8220;TwelveStep&#8221;</title>
		<link>http://log.liminastudio.com/itp/prototyping-twelvestep</link>
		<comments>http://log.liminastudio.com/itp/prototyping-twelvestep#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:02:59 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[MIDI controller]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Prototypes]]></category>
		<category><![CDATA[Sound]]></category>
		<category><![CDATA[step-sequencer]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=291</guid>
		<description><![CDATA[&#8220;TwelveStep&#8221; is the working title for a wireless dodecahedral step-sequencer and MIDI controller.]]></description>
			<content:encoded><![CDATA[<p>&#8220;TwelveStep&#8221; is the working title for a wireless dodecahedral step-sequencer and MIDI controller.</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_01.jpg"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-300" title="TwelveStep: Sketches" src="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_01-150x150.jpg" alt="TwelveStep: Sketches" width="150" height="150" /></a><a href="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_02.jpg"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-301" title="TwelveStep: Sketches: Polyhedral graphs" src="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_02-150x150.jpg" alt="TwelveStep: Sketches: Polyhedral graphs" width="150" height="150" /></a><a href="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_03.jpg"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-302" title="TwelveStep: Sketches: Usage" src="http://log.liminastudio.com/wp-content/uploads/2009/04/twelvestep_notes_03-150x150.jpg" alt="TwelveStep: Sketches: Usage" width="150" height="150" /></a><a href="http://log.liminastudio.com/wp-content/uploads/2009/04/12step-laser.png"  rel="lightbox[roadtrip]"><img class="alignnone size-thumbnail wp-image-298" title="TwelveStep: Laser etching and cutting pattern" src="http://log.liminastudio.com/wp-content/uploads/2009/04/12step-laser-150x150.png" alt="TwelveStep: Laser etching and cutting pattern" width="150" height="150" /></a></p>
<p><object
		width="450"
		height="340"
		data="http://vimeo.com/moogaloop.swf?clip_id=4244593&amp;server=vimeo.com"
		type="application/x-shockwave-flash">
			<param name="allowfullscreen" value="true" />
			<param name="allowscriptaccess" value="always" />
			<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=4244593&amp;server=vimeo.com" />
		</object>
</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/prototyping-twelvestep/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XBee Series 1 Handy Command Reference</title>
		<link>http://log.liminastudio.com/itp/xbee-series-1-handy-command-reference</link>
		<comments>http://log.liminastudio.com/itp/xbee-series-1-handy-command-reference#comments</comments>
		<pubDate>Mon, 09 Mar 2009 21:51:30 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[ITP]]></category>
		<category><![CDATA[Networked Objects]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[xbee]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=249</guid>
		<description><![CDATA[Here are the AT commands I have most frequently needed for the Floatometers / Shakeometers.  Remember, ALL NUMBER VALUES ARE IN HEX! ATID &#8211; PAN ID ATDH/DL &#8211; Destination address high/low: which local address to send ADC data ATMY &#8211; Local address of this unit ATD0&#8230;D8 &#8211; digital pins I/O enable ATP0&#8230;P1 &#8211; PWM output [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the AT commands I have most frequently needed for the Floatometers / Shakeometers.  Remember, ALL NUMBER VALUES ARE IN HEX!</p>
<p>ATID &#8211; PAN ID<br />
ATDH/DL &#8211; Destination address high/low: which local address to send ADC data<br />
ATMY &#8211; Local address of this unit</p>
<p>ATD0&#8230;D8 &#8211; digital pins I/O enable<br />
ATP0&#8230;P1 &#8211; PWM output enable<br />
ATIU &#8211; I/O output enable (UART) &#8211; send out through serial<br />
ATIA &#8211; I/O input address &#8211; address to pay attention to for serial output<br />
ATIT &#8211; ADC Samples before TX<br />
ATIR &#8211; ADC Sample rate (ms)</p>
<p>ATBD &#8211; Baud Rate: 3 = 9600, 7 = 115200<br />
ATWR &#8211; Write parameter values</p>
<p>Interesting note from the manual: &#8220;The maximum sample rate that can be achieved while using one A/D line is 1 sample/ms or 1 KHz (Note that the modem will not be able to keep up with transmission when IR &amp; IT are equal to “1”).&#8221;</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/xbee-series-1-handy-command-reference/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pComp: &#8220;SpinTone&#8221; in process</title>
		<link>http://log.liminastudio.com/itp/physical-computing/pcomp-spintone-in-process</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/pcomp-spintone-in-process#comments</comments>
		<pubDate>Wed, 22 Oct 2008 01:54:25 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[ITP]]></category>
		<category><![CDATA[pcomp]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=148</guid>
		<description><![CDATA[&#8220;SpinTone&#8221; is a data auralizer that uses an array of 10 60mm fans to generate fixed tones by blowing over bottles. We&#8217;re using a small Arduino program that reads in single integers to toggle the state of each fan, and a Processing app that sends these signals over serial. Here we are initially testing the [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;SpinTone&#8221; is a data auralizer that uses an array of 10 60mm fans to generate fixed tones by blowing over bottles.  We&#8217;re using a small Arduino program that reads in single integers to toggle the state of each fan, and a Processing app that sends these signals over serial.</p>
<p>Here we are initially testing the fans and arduino program with a simple digital momentary switch:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/IYzwPYrZsU4" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/IYzwPYrZsU4"></embed></object></p>
<p>We used an array of TIP120 transistors to control the 12v fans with the 5v Arduino control signals:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/chwk8yTfr9M" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/chwk8yTfr9M"></embed></object></p>
<p>We added LED indicators in parallel with the transistor&#8217;s control input and linked my keyboard&#8217;s home row keys to the array:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/tkwqwdIUl1c" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/tkwqwdIUl1c"></embed></object></p>
<p>Patrick has been working on a Processing interface that retrieves the number of hits a search term returns on a variety of newssources.  More to follow!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/pcomp-spintone-in-process/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pComp: Servo Lab</title>
		<link>http://log.liminastudio.com/itp/physical-computing/pcomp-servo-lab</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/pcomp-servo-lab#comments</comments>
		<pubDate>Tue, 30 Sep 2008 01:46:21 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[flex sensor]]></category>
		<category><![CDATA[servo]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=117</guid>
		<description><![CDATA[A flex sensor controls the movement of a servo.]]></description>
			<content:encoded><![CDATA[<p>A flex sensor controls the movement of a servo.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="350" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/cLrsfORGs0M" /><embed type="application/x-shockwave-flash" width="425" height="350" src="http://www.youtube.com/v/cLrsfORGs0M"></embed></object></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/pcomp-servo-lab/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pComp: Electricity &amp; Metering</title>
		<link>http://log.liminastudio.com/itp/physical-computing/pcomp-electricity-metering</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/pcomp-electricity-metering#comments</comments>
		<pubDate>Tue, 23 Sep 2008 00:03:22 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[electricity]]></category>
		<category><![CDATA[metering]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=102</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-d788febf-3966-424d-80d2-ad4b577aa970.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-d788febf-3966-424d-80d2-ad4b577aa970.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-e69b1a65-99ab-4bd4-85db-21871e52b8f7.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-e69b1a65-99ab-4bd4-85db-21871e52b8f7.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-d89f4b5d-caf0-4759-b39b-e1aecb7e8f6c.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-d89f4b5d-caf0-4759-b39b-e1aecb7e8f6c.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-32b63545-52d2-4555-ab81-8bdd0dfef6cf.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-32b63545-52d2-4555-ab81-8bdd0dfef6cf.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-dffeb2b0-42d8-4bc6-ba22-a73f20ee52e4.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-dffeb2b0-42d8-4bc6-ba22-a73f20ee52e4.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-57808ed9-b0ff-4f2e-9d6c-e7459f5b0c81.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-57808ed9-b0ff-4f2e-9d6c-e7459f5b0c81.jpeg" alt="" width="225" height="300" /></a></p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-9d0a2ba1-0f9f-48be-b60a-5e935846ed76.jpeg"  rel="lightbox[roadtrip]"><img class="alignnone size-full wp-image-364" src="http://log.liminastudio.com/wp-content/uploads/2008/09/p-640-480-9d0a2ba1-0f9f-48be-b60a-5e935846ed76.jpeg" alt="" width="225" height="300" /></a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/pcomp-electricity-metering/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pComp: Digital Pulse-Width Modulation of LEDs via Arduino</title>
		<link>http://log.liminastudio.com/itp/physical-computing/arduino-pulse-width-modulation-of-leds</link>
		<comments>http://log.liminastudio.com/itp/physical-computing/arduino-pulse-width-modulation-of-leds#comments</comments>
		<pubDate>Mon, 08 Sep 2008 23:28:10 +0000</pubDate>
		<dc:creator>Tedb0t</dc:creator>
				<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://log.liminastudio.com/?p=11</guid>
		<description><![CDATA[Day 1 consisted of just plugging the Arduino in to see if it works and transmits properly.  Today, despite an incipient cold (wtf?), I made better headway into learning about the device. After some initial tests blinking an LED, I decided to make a little sinusoidal pulse-width modulator and blink two LEDs: Pulse-Width Modulation of [...]]]></description>
			<content:encoded><![CDATA[<p>Day 1 consisted of just plugging the Arduino in to see if it works and transmits properly.  Today, despite an incipient cold (wtf?), I made better headway into learning about the device.</p>
<p>After some initial tests blinking an LED, I decided to make a little sinusoidal pulse-width modulator and blink two LEDs:</p>
<p><a href="http://log.liminastudio.com/wp-content/uploads/2008/09/snc12089.avi">Pulse-Width Modulation of LEDs</a></p>
<p>If you watch it you can see the LEDs blink faster and faster and then slower and slower (the avi&#8217;s framerate of ~15 of course interferes with this).  The relevant code is:</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">blinkFreq <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>sin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">*</span> PI <span style="color: #339933;">/</span> <span style="color: #0000dd;">180</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> freqMod<span style="color: #339933;">;</span>
...
<span style="color: #202020;">digitalWrite</span><span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
delay<span style="color: #009900;">&#40;</span>blinkFreq <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
digitalWrite<span style="color: #009900;">&#40;</span>ledPin<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
digitalWrite<span style="color: #009900;">&#40;</span>ledPin2<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
delay<span style="color: #009900;">&#40;</span>blinkFreq <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>where i is incremented in the Arduino loop and reset after 360.  I could have just used radians but then I&#8217;d be incrementing a float value or something so&#8230; meh.</p>
<p>I&#8217;m not sure if there&#8217;s a better or more logical PWM algorithm, I haven&#8217;t tried looking one up as this basically does the trick.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://log.liminastudio.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://log.liminastudio.com/itp/physical-computing/arduino-pulse-width-modulation-of-leds/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://log.liminastudio.com/wp-content/uploads/2008/09/snc12089.avi" length="14078412" type="video/x-msvideo" />
		</item>
	</channel>
</rss>
