<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Robot is Happy</title>
	<atom:link href="http://www.robotishappy.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robotishappy.com</link>
	<description>creating our robot overlords one day at a time</description>
	<lastBuildDate>Tue, 19 Oct 2010 13:29:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" - maintenance_release="8.8.5.3" -->
	<copyright>2006-2007 </copyright>
	<managingEditor>chris@robotishappy.com (Robot is Happy)</managingEditor>
	<webMaster>chris@robotishappy.com (Robot is Happy)</webMaster>
	<category>posts</category>
	<image>
		<url>http://www.robotishappy.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>Robot is Happy</title>
		<link>http://www.robotishappy.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>creating our robot overlords one day at a time</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &amp; Culture" />
	<itunes:author>Robot is Happy</itunes:author>
	<itunes:owner>
		<itunes:name>Robot is Happy</itunes:name>
		<itunes:email>chris@robotishappy.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.robotishappy.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Robotic Curtain &#8211; Not necessarily effective, but definitely awesome.</title>
		<link>http://www.robotishappy.com/2010/10/robotic-curtain-not-necessarily-effective-but-definitely-awesome/</link>
		<comments>http://www.robotishappy.com/2010/10/robotic-curtain-not-necessarily-effective-but-definitely-awesome/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 13:29:13 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Other People's Robots]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=528</guid>
		<description><![CDATA[Niklas Roy created a curtain to shield his projects from curious onlookers...only to garner more curiosity. And the video ain't too bad either. Enjoy.

Check it out.
]]></description>
			<content:encoded><![CDATA[<p>Niklas Roy created a curtain to shield his projects from curious onlookers...only to garner more curiosity. And the video ain't too bad either. Enjoy.</p>
<p><object width="640" height="390"><param name="movie" value="http://www.youtube.com/v/rKhbUjVyKIc&#038;rel=0&#038;hl=de_DE&#038;feature=player_embedded&#038;version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/rKhbUjVyKIc&#038;rel=0&#038;hl=de_DE&#038;feature=player_embedded&#038;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"></embed></object></p>
<p><a href="http://www.niklasroy.com/project/88/my-little-piece-of-privacy">Check it out.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/10/robotic-curtain-not-necessarily-effective-but-definitely-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sign Language Translator</title>
		<link>http://www.robotishappy.com/2010/10/sign-language-translator/</link>
		<comments>http://www.robotishappy.com/2010/10/sign-language-translator/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 15:53:17 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Other People's Robots]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=524</guid>
		<description><![CDATA[Awesome use of the Arduino Mega and other various sensors.  Consider me awestruck.


Translation from one language to another is often like swapping variable values; you need something in the middle. That’s why translators were invented, but the opportunity for them to interject obscene comments made communication between people of different languages uneasy. And since [...]]]></description>
			<content:encoded><![CDATA[<p>Awesome use of the Arduino Mega and other various sensors.  Consider me awestruck.</p>
<p><img src="http://farm5.static.flickr.com/4130/5045447395_e1ab2879d5.jpg" alt="Sign Language Glove" /></p>
<blockquote><p>
Translation from one language to another is often like swapping variable values; you need something in the middle. That’s why translators were invented, but the opportunity for them to interject obscene comments made communication between people of different languages uneasy. And since my understanding of other languages is a bit rusty, and my group needed a project with a biomedical bent, we decided to translate from American English to American Sign Language. That’s right, you should be really excited right now.
</p></blockquote>
<p><a href="http://www.clloks.com/?p=8">Check it Out</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/10/sign-language-translator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evil Mad Scientist Disects the Venerable Nixie Tube</title>
		<link>http://www.robotishappy.com/2010/09/evil-mad-scientist-disects-the-venerable-nixie-tube/</link>
		<comments>http://www.robotishappy.com/2010/09/evil-mad-scientist-disects-the-venerable-nixie-tube/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 14:12:23 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Other People's Robots]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=521</guid>
		<description><![CDATA[Evil Mad Scientist dissected a Nixie tube to see what makes it tick (or light up, as the case may be).


Don't you just love nixie tubes? They glow with a lovely neon color and have gorgeous stylized numbers-- something you can't get with a dot matrix-- or even sixteen-segment LED or LCD display.

Check it Out
- [...]]]></description>
			<content:encoded><![CDATA[<p>Evil Mad Scientist dissected a Nixie tube to see what makes it tick (or light up, as the case may be).<br />
<a href="http://www.robotishappy.com/wp-content/uploads/2010/09/number_4_nixie.jpg"><img src="http://www.robotishappy.com/wp-content/uploads/2010/09/number_4_nixie.jpg" alt="" title="number 4 from a nixie tube" width="500" height="375" class="alignnone size-full wp-image-522" /></a></p>
<blockquote><p>
Don't you just love nixie tubes? They glow with a lovely neon color and have gorgeous stylized numbers-- something you can't get with a dot matrix-- or even sixteen-segment LED or LCD display.
</p></blockquote>
<p><a href="http://www.evilmadscientist.com/article.php/nixietube">Check it Out</a></p>
<p>- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/09/evil-mad-scientist-disects-the-venerable-nixie-tube/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arduino &#8211; Something New!!</title>
		<link>http://www.robotishappy.com/2010/09/arduino-something-new/</link>
		<comments>http://www.robotishappy.com/2010/09/arduino-something-new/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 23:37:23 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=518</guid>
		<description><![CDATA[Arduino has something new.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.robotishappy.com/wp-content/uploads/2010/09/mysteryDuino.jpg"><img src="http://www.robotishappy.com/wp-content/uploads/2010/09/mysteryDuino-300x208.jpg" alt="Something New." title="mysteryDuino" width="300" height="208" class="alignnone size-medium wp-image-519" /></a></p>
<p>Arduino has something in the works. I can only wonder what it is, but I already want it. <a href="http://http://arduino.cc/">I want it so bad.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/09/arduino-something-new/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Evil Mad Scientists Release Egg-Bot Kit</title>
		<link>http://www.robotishappy.com/2010/09/evil-mad-scientists-release-egg-bot-kit/</link>
		<comments>http://www.robotishappy.com/2010/09/evil-mad-scientists-release-egg-bot-kit/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 19:06:41 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Other People's Robots]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=515</guid>
		<description><![CDATA[Amazing kit from Evil Mad Scientist.  The Egg-bot is, I think, an amazing execution of a novel and whimsical idea. ]]></description>
			<content:encoded><![CDATA[<p>Amazing kit from Evil Mad Scientist.  The Egg-bot is, I think, an amazing execution of a novel and whimsical idea.<br />
<div id="attachment_516" class="wp-caption alignleft" style="width: 310px"><a href="http://www.robotishappy.com/wp-content/uploads/2010/09/4970935346_123ee543f2.jpg"><img src="http://www.robotishappy.com/wp-content/uploads/2010/09/4970935346_123ee543f2-300x225.jpg" alt="Evil Mad Scientist Egg-bot" title="Evil Mad Scientist Egg-bot" width="300" height="225" class="size-medium wp-image-516" /></a><p class="wp-caption-text">Evil Mad Scientist Egg-bot</p></div></p>
<blockquote><p>
So what's an Eggbot? It's a machine capable of drawing on spherical or ellipsoidal surfaces. You might say, a pen plotter for spherical coordinates. Or a simple but unusual CNC machine, ripe for hacking. Or an educational robot-- and you'd be right on all accounts.
</p></blockquote>
<p><a href="http://www.evilmadscientist.com/article.php/eggbot">Pre order yours today.</a></p>
<p>- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/09/evil-mad-scientists-release-egg-bot-kit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jSON library for Arduino</title>
		<link>http://www.robotishappy.com/2010/09/json-library-for-arduino/</link>
		<comments>http://www.robotishappy.com/2010/09/json-library-for-arduino/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 01:44:19 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Other People's Robots]]></category>
		<category><![CDATA[library]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=512</guid>
		<description><![CDATA[Exchanging data with other computers can be a daunting task with Arduino. No matter if you just want to pass some information to Processing, to a Web Service or something else – You always have to encode the data and decode the answer.]]></description>
			<content:encoded><![CDATA[<blockquote><p>
Exchanging data with other computers can be a daunting task with Arduino. No matter if you just want to pass some information to Processing, to a Web Service or something else – You always have to encode the data and decode the answer.</p>
<p>There always have been solutions like XML for structured data. But XML is hard to decode, complicated an takes up a lot of space. And then there is JSON. JSON is an easy and efficient way to transfer data.
</p></blockquote>
<p><a href="http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/">Check out the tutorial and library.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/09/json-library-for-arduino/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Best POV Ever</title>
		<link>http://www.robotishappy.com/2010/08/the-best-pov-ever/</link>
		<comments>http://www.robotishappy.com/2010/08/the-best-pov-ever/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 01:42:56 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Other People's Robots]]></category>
		<category><![CDATA[POV]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=509</guid>
		<description><![CDATA[I'm not usually one to ooh and ahh over a POV display, but this one takes the cake.

Check out the project page.
- Chris
]]></description>
			<content:encoded><![CDATA[<p>I'm not usually one to ooh and ahh over a POV display, but this one takes the cake.<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Q1saYuGyw7A&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/Q1saYuGyw7A&#038;color1=0xb1b1b1&#038;color2=0xd0d0d0&#038;hl=en_US&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="385"></embed></object></p>
<p><a href="http://www.elektronika.ba/779/pov-propeller-clock-build/">Check out the project page.</a></p>
<p>- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/08/the-best-pov-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stuff I&#8217;m Researching for a Project</title>
		<link>http://www.robotishappy.com/2010/08/stuff-im-researching-for-a-project/</link>
		<comments>http://www.robotishappy.com/2010/08/stuff-im-researching-for-a-project/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 02:19:09 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Stuff I'm Researching]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=506</guid>
		<description><![CDATA[In addition to working with a <a href="http://www.robotishappy.com/2010/08/part-1-visualizing-3-axis-accelerometer-readings-in-processing/">3-Axis accelerometer</a>, I'm about to start another project which will take some quite some time to build.  I've been doing a lot of research on leds and timing.  Thought I'd put it out there]]></description>
			<content:encoded><![CDATA[<p>In addition to working with a <a href="http://www.robotishappy.com/2010/08/part-1-visualizing-3-axis-accelerometer-readings-in-processing/">3-Axis accelerometer</a>, I'm about to start another project which will take some quite some time to build.  I've been doing a lot of research on leds and timing.  Thought I'd put it out there.  Hopefully, I'll have some idea of what the final plans will be soon.</p>
<h2>Here's the links:</h2>
<ul>
<li><a href="http://www.delabs-circuits.com/cirdir/theory/gates/doc00020.html?rb_dsp=10K">http://www.delabs-circuits.com/cirdir/theory/gates/doc00020.html?rb_dsp=10K</a></li>
<li><a href="http://www.evilmadscientist.com/article.php/CylonOLantern">http://www.evilmadscientist.com/article.php/CylonOLantern</a></li>
<li><a href="http://hackaday.com/2009/06/29/parts-shiftbrite-rgb-led-module-a6281/">http://hackaday.com/2009/06/29/parts-shiftbrite-rgb-led-module-a6281/</a>
<li><a href="http://macetech.com/store/index.php?main_page=index&#038;cPath=1&#038;zenid=8023462175c41315b6119e4270d0c531">http://macetech.com/store/index.php?main_page=index&#038;cPath=1&#038;zenid=8023462175c41315b6119e4270d0c531</a></li>
<li><a href="http://en.wikipedia.org/wiki/Charlieplexing">http://en.wikipedia.org/wiki/Charlieplexing</a></li>
<li><a href="http://www.allaboutcircuits.com/vol_6/chpt_7/6.html">http://www.allaboutcircuits.com/vol_6/chpt_7/6.html</a></li>
</ul>
<p>No, it won't be another Cylon scanner, but light and timing are very important parts of it.</p>
<p>- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/08/stuff-im-researching-for-a-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Part 1) Visualizing 3-Axis Accelerometer Readings in Processing</title>
		<link>http://www.robotishappy.com/2010/08/part-1-visualizing-3-axis-accelerometer-readings-in-processing/</link>
		<comments>http://www.robotishappy.com/2010/08/part-1-visualizing-3-axis-accelerometer-readings-in-processing/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 02:59:23 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Radio Control]]></category>
		<category><![CDATA[Accelerometer]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=472</guid>
		<description><![CDATA[So I started playing around with a 3-Axis Accelerometer in the hopes of dreaming up some project or other.  So I hooked it up to my Arduino and my Arduino to my computer and wrote a little Processing code to graph it all into pretty colors.]]></description>
			<content:encoded><![CDATA[<p>It's been a while since I've had the chance to do anything vaguely electronic. Sure, I've painted rooms in my house, installed ceiling fans, added insulation to my attic, but that's a far cry from programming in Wiring or Processing.  So, thankfully, after getting my new workspace all put together, I got the chance to play with some of the parts I've had waiting in a few SparkFun boxes.</p>
<p>So I started playing around with a 3-Axis Accelerometer in the hopes of dreaming up some project or other.  So I hooked it up to my Arduino and my Arduino to my computer and wrote a little Processing code to graph it all into pretty colors.  As with all of my projects, the first step for me is understanding and since I didn't have much experience with Accelerometers a little crash course was in order.  As it turns out, it's a fairly simple sensor to use (or collection of 3 sensors: x, y, z, I should say). Simply plug the VCC connector into the Arduino 3V pin (not the 5V pin. The ADXL3305 chip is only rated to 3.3V), the ground into ground and the x, y, and z pins into 0,1,2 analog pins.  The code for the Arduino is simple:</p>
<h2>The Arduino Code</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#define X_AXIS 0</span>
<span style="color: #339933;">#define Y_AXIS 1</span>
<span style="color: #339933;">#define Z_AXIS 2</span>
&nbsp;
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> x <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span>X_AXIS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> y <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span>Y_AXIS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> z <span style="color: #339933;">=</span> analogRead<span style="color: #009900;">&#40;</span>Z_AXIS<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>y<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>z<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It takes the readings in and outputs them into a formatted string '[x]|[y]:[z]'. That's it.  This is just for outputting data right now, so nothing special. It gets more interesting when we look at the processing.</p>
<h2>The Processing Code in Action</h2>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/vblcfZ291vw&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vblcfZ291vw&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>The code that makes the sweet, sweet video above isn't necessarily complicated, but there may be a few things you haven't used in Processing before.</p>
<ul>
<li><a href="http://processing.org/reference/map_.html">map(value, low1, high1, low2, high2)</a> - converts a value from one range into a corresponding value into another range.</li>
<li><a href="http://processing.org/reference/norm_.html">norm(value, low, high)</a> - converts a value into a value from 0.0 to 1.0 based on the supplied range.</li>
<li><a href="http://processing.org/reference/popMatrix_.html">pushMatrix()</a> / <a href="http://processing.org/reference/pushMatrix_.html">popMatrix()</a> - the pushMatrix() and popMatrix() methods allow you to apply rotation, translation, and other methods to a specific style.  By issuing the pushMatrix() then calling the translate(), and rotateX, rotateY methods, you can then call popMatrix so those methods don't affect other elements being rendered by Processing.</li>
</ul>
<h2>The Processing Code</h2>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">processing.serial.*</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">processing.opengl.*</span><span style="color: #339933;">;</span>
Serial myPort<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> baudRate <span style="color: #339933;">=</span> <span style="color: #cc66cc;">9600</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> lf <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
&nbsp;
PFont font<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> xAxis<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> yAxis<span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> zAxis<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> currentX <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> currentY <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> currentZ <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//these value were determined by taking readings from a resting position</span>
<span style="color: #000066; font-weight: bold;">int</span> oneGSensorValue <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">float</span> oneGMillivolt <span style="color: #339933;">=</span> oneGSensorValue <span style="color: #339933;">*</span> <span style="color: #cc66cc;">4.9</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> totalReadings <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">int</span> readingPos <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// the reading position in the array</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  smooth<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  size<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">600</span>, <span style="color: #cc66cc;">300</span>, OPENGL<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
  font <span style="color: #339933;">=</span> createFont<span style="color: #009900;">&#40;</span>PFont.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">270</span><span style="color: #009900;">&#93;</span>, <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  smallFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  xAxis <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>totalReadings<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  yAxis <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>totalReadings<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  zAxis <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span>totalReadings<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> totalReadings<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    xAxis<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> oneGSensorValue<span style="color: #339933;">;</span>
    yAxis<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> oneGSensorValue<span style="color: #339933;">;</span>
    zAxis<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> oneGSensorValue<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  myPort <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Serial<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, Serial.<span style="color: #006633;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>, baudRate<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  myPort.<span style="color: #006633;">bufferUntil</span><span style="color: #009900;">&#40;</span>lf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  noLoop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> serialEvent<span style="color: #009900;">&#40;</span>Serial p<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">String</span> inString<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span>
    inString <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>myPort.<span style="color: #006633;">readString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    currentX <span style="color: #339933;">=</span> xValue<span style="color: #009900;">&#40;</span>inString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    currentY <span style="color: #339933;">=</span> yValue<span style="color: #009900;">&#40;</span>inString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    currentZ <span style="color: #339933;">=</span> zValue<span style="color: #009900;">&#40;</span>inString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    xAxis <span style="color: #339933;">=</span> insertValueIntoArray<span style="color: #009900;">&#40;</span>xAxis, currentX, readingPos, totalReadings<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    yAxis <span style="color: #339933;">=</span> insertValueIntoArray<span style="color: #009900;">&#40;</span>yAxis, currentY, readingPos, totalReadings<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    zAxis <span style="color: #339933;">=</span> insertValueIntoArray<span style="color: #009900;">&#40;</span>zAxis, currentZ, readingPos, totalReadings<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    readingPos <span style="color: #339933;">=</span> readingPos <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// increment the array position</span>
  <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   println<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  redraw<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> draw<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  background<span style="color: #009900;">&#40;</span>#FEFFFC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  drawGraph<span style="color: #009900;">&#40;</span>xAxis, <span style="color: #cc66cc;">100</span>, color<span style="color: #009900;">&#40;</span>#<span style="color: #cc66cc;">519050</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;X - Axis&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
  drawGraph<span style="color: #009900;">&#40;</span>yAxis, <span style="color: #cc66cc;">200</span>, color<span style="color: #009900;">&#40;</span>#708CDE<span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;Y - Axis&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  drawGraph<span style="color: #009900;">&#40;</span>zAxis, <span style="color: #cc66cc;">300</span>, color<span style="color: #009900;">&#40;</span>#D38031<span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;Z - Axis&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  draw3d<span style="color: #009900;">&#40;</span>currentX, currentY, currentZ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> drawGraph<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> arrToDraw, <span style="color: #000066; font-weight: bold;">int</span> yPos, color graphColor, <span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">int</span> arrLength <span style="color: #339933;">=</span> arrToDraw.<span style="color: #006633;">length</span><span style="color: #339933;">;</span>
  stroke<span style="color: #009900;">&#40;</span>graphColor<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> x<span style="color: #339933;">&lt;</span>arrLength <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">float</span> normalizedLine <span style="color: #339933;">=</span> norm<span style="color: #009900;">&#40;</span>arrToDraw<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span>, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">700.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">float</span> lineHeight <span style="color: #339933;">=</span> map<span style="color: #009900;">&#40;</span>normalizedLine, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">0.00</span>, <span style="color: #cc66cc;">85.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    line<span style="color: #009900;">&#40;</span>x, yPos, x, yPos <span style="color: #339933;">-</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#40;</span>lineHeight<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
  pushStyle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  smallFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  stroke<span style="color: #009900;">&#40;</span>#FFFFFF<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  fill<span style="color: #009900;">&#40;</span>#FFFFFF<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003399;">String</span> gString <span style="color: #339933;">=</span> nfc<span style="color: #009900;">&#40;</span>gFromSensorValue<span style="color: #009900;">&#40;</span>arrToDraw<span style="color: #009900;">&#91;</span>arrLength <span style="color: #339933;">-</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  text<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; : &quot;</span> <span style="color: #339933;">+</span> gString <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; Gs&quot;</span>, <span style="color: #cc66cc;">10</span>, yPos <span style="color: #339933;">-</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  popStyle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> draw3d<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> currentX, <span style="color: #000066; font-weight: bold;">int</span> currentY, <span style="color: #000066; font-weight: bold;">int</span> currentZ<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">float</span> normalizedX <span style="color: #339933;">=</span> norm<span style="color: #009900;">&#40;</span>currentX, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">700.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> normalizedY <span style="color: #339933;">=</span> norm<span style="color: #009900;">&#40;</span>currentY, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">700.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> normalizedZ <span style="color: #339933;">=</span> norm<span style="color: #009900;">&#40;</span>currentZ, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">700.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> finalZ <span style="color: #339933;">=</span> map<span style="color: #009900;">&#40;</span>normalizedZ, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span>, <span style="color: #cc66cc;">300.00</span>, <span style="color: #cc66cc;">0.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> finalY <span style="color: #339933;">=</span> map<span style="color: #009900;">&#40;</span>normalizedY, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">3.5</span>, <span style="color: #cc66cc;">3.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> finalX <span style="color: #339933;">=</span> map<span style="color: #009900;">&#40;</span>normalizedX, <span style="color: #cc66cc;">0.0</span>, <span style="color: #cc66cc;">1.0</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">3.5</span>, <span style="color: #cc66cc;">3.5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  pushMatrix<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ambientLight<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">102</span>, <span style="color: #cc66cc;">102</span>, <span style="color: #cc66cc;">102</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  lightSpecular<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">204</span>, <span style="color: #cc66cc;">204</span>, <span style="color: #cc66cc;">204</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  directionalLight<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">102</span>, <span style="color: #cc66cc;">102</span>, <span style="color: #cc66cc;">102</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>, <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  shininess<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  translate<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">500</span>, finalZ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  rotateY<span style="color: #009900;">&#40;</span>finalY <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1.0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  rotateZ<span style="color: #009900;">&#40;</span>finalX<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  fill<span style="color: #009900;">&#40;</span>#E2E8D5<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  noStroke<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  fill<span style="color: #009900;">&#40;</span>#B76F6F<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">float</span> heightWidth <span style="color: #339933;">=</span> finalX <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1.8</span><span style="color: #339933;">;</span>
  box<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">65</span>, <span style="color: #cc66cc;">65</span>, <span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  popMatrix<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> xValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> inString<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">int</span> pipeIndex <span style="color: #339933;">=</span> inString.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#40;</span>inString.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>,pipeIndex<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> yValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> inString<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">int</span> pipeIndex <span style="color: #339933;">=</span> inString.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">int</span> colonIndex <span style="color: #339933;">=</span> inString.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#40;</span>inString.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>pipeIndex<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span>, colonIndex<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> zValue<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> inString<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">int</span> colonIndex <span style="color: #339933;">=</span> inString.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#40;</span>inString.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>colonIndex <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span>, inString.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
This little method creates a running tally of all the incoming sensor readings
and then, when it reaches the end of the array, it pops the first one of the beginning
and inserts a new value in at the end...thus keeping a running tally of the last 400
readings (it can be for any length array, that's just what it's set to for this project).
This works a lot like an RRD graph where my inspiration came from.
*/</span>
<span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> insertValueIntoArray<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> targetArray, <span style="color: #000066; font-weight: bold;">int</span> val, <span style="color: #000066; font-weight: bold;">int</span> pos, <span style="color: #000066; font-weight: bold;">int</span> maxLength<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>pos <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span>maxLength<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// if the pos == maxSize, shift the array to retain the original value</span>
     <span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> returnArray <span style="color: #339933;">=</span> subset<span style="color: #009900;">&#40;</span>targetArray, <span style="color: #cc66cc;">1</span>, maxLength<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     returnArray <span style="color: #339933;">=</span> expand<span style="color: #009900;">&#40;</span>returnArray, maxLength<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     returnArray<span style="color: #009900;">&#91;</span>maxLength<span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> val<span style="color: #339933;">;</span>
     <span style="color: #000000; font-weight: bold;">return</span> returnArray<span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
     targetArray<span style="color: #009900;">&#91;</span>pos<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> val<span style="color: #339933;">;</span>
     <span style="color: #000000; font-weight: bold;">return</span> targetArray<span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
This conversion will vary from project to project
and if you're project is relying on battery power
the reading may need to be adjusted to give you true 
one G as your battery power decreases.  All of this is due to
the output of the X,Y, and Z sensors and their coorelation to the incoming voltage at VCC
Check out the specs for the ADXL335 (part of the break out board from Sparkfun.com) here: http://www.analog.com/en/sensors/inertial-sensors/adxl335/products/product.html
*/</span>
<span style="color: #000066; font-weight: bold;">float</span> gFromSensorValue<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> sensorValue<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//convert analog value into millivolts</span>
  <span style="color: #000066; font-weight: bold;">float</span> mvValue <span style="color: #339933;">=</span> sensorValue <span style="color: #339933;">*</span> <span style="color: #cc66cc;">4.9</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">return</span> mvValue<span style="color: #339933;">/</span>oneGMillivolt<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">void</span> smallFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  textFont<span style="color: #009900;">&#40;</span>font, <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">void</span> mediumFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> textFont<span style="color: #009900;">&#40;</span>font, <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">void</span> largeFont<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  textFont<span style="color: #009900;">&#40;</span>font, <span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is just the first step of a larger project to create a DIY radio control using an xBee and this 3-axis accelerometer.</p>
<p>Happy Coding.<br />
- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/08/part-1-visualizing-3-axis-accelerometer-readings-in-processing/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Finally, Back to Work</title>
		<link>http://www.robotishappy.com/2010/08/finally-back-to-work/</link>
		<comments>http://www.robotishappy.com/2010/08/finally-back-to-work/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 01:07:50 +0000</pubDate>
		<dc:creator>Christopher Hazlett</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Workbench]]></category>

		<guid isPermaLink="false">http://www.robotishappy.com/?p=475</guid>
		<description><![CDATA[I alluded to, a while ago, that both Alex and I had moved recently (not together, but the timing was eerily similar) and that had necessarily precluded any kind electronics experimentation. Well, we're both getting settled into our new homes and at least one of us has been able to get back to electronics.]]></description>
			<content:encoded><![CDATA[<p>I alluded to, a while ago, that both Alex and I had moved recently (not together, but the timing was eerily similar) and that had necessarily precluded any kind of electronics experimentation. Well, we're both getting settled into our new homes and at least one of us has been able to get back to electronics.  That would be me, but my biggest experiment (my first kid) isn't due until January.  So I better get cracking on all this other stuff that doesn't require diapers and midnight feedings.</p>
<p>My wife and I recently moved into our new home out in suburban New Jersey (much maligned but quite lovely I assure you).  We moved mostly because we needed more room than our one bedroom condo could provide.  So after 8 years of living the urban life style in Hoboken, NJ, we've finally made the leap 20 miles west to New Providence, NJ.  We couldn't be happier.  But my new bucolic atmosphere is not the reason for this post.  The reason for this post, and maybe the real reason for buying the house, is that I finally have one room dedicated to electronics exploration. Previously, I had to keep all electronics and tools stashed in multiple shoe boxes and <a href="http://www.sparkfun.com">SparkFun</a> boxes in my closet, under my bed, and behind books.  Starting and finishing a project was an endless act of cleaning up after myself and infuriating both me and my wife with a constant deluge of jumper cables, glue guns, and robot parts spread over our dining room table.</p>
<p>Those days, my friends, are over.  Now I can leave parts out (though I don't generally now that I have places to put things) until my heart tells me they should be put away.  And although I share my workspace with the laundry, it's still a place I can call my own. Without further ado, the new workbench, where all future projects will be completed and lovingly dismantled for the next one.</p>
<h2>The Workbench</h2>
<p><img src="http://www.robotishappy.com/wp-content/uploads/2010/08/bench.jpg" alt="Workbench" title="Workbench" class="size-full wp-image-484" /></p>
<p><img src="http://www.robotishappy.com/wp-content/uploads/2010/08/parts_box.jpg" alt="Parts Box" title="Parts Box" class="size-full wp-image-485" /></p>
<h2>The Parts</h2>
<ul>
<li><a href="http://www.northerntool.com/shop/tools/product_200226224_200226224">2x4 Basics AnySize Workbench Kit</a> - This is a great workbench kit. You buy the 2x4's and plywood for the top and put the thing together. Took me about 2 hours to cut everything and screw it together, but I have power tools which help tremendously. All told, it cost me about $180 - $200 all in. For comparably sized and weight rated work benches, you can't find a better deal. Plus you get to put it together.</li>
<li><a href="http://www.lowes.com/pd_8189-84396-17186819_0_?productId=3083761&#038;Ntt=keter&#038;Ntk=i_products&#038;pl=1&#038;currentURL=/pl__0__s?newSearch=true$Ntt=keter$y=0$x=0">Keter  18" Cantilever Pro Organizer</a> - I saw this parts organizer while picking up paint for my now rented condo in Hoboken.  It's fantastic for all the little screws, batteries, sensors, and shields.  The drawers on the bottom actually fit an Arduino Duemilanove quite nicely.</li>
<li><a href="http://www.sparkfun.com/commerce/product_info.php?products_id=85">AOYUE 70W Digital Soldering Iron</a> - Available from SparkFun. I finally graduated away from the $25 RadioShack soldering iron...possibly because I now have the space and a permanent place for a sweet, sweet iron, and possibly because I'm a grown man who should have such things.  I finally fired it up a few weeks ago, and it really is nice.</li>
</ul>
<p>I've got a new project in the works and the first write-up will be coming later this week (Spoiler Alert: Accelerometer and Xbees).</p>
<p>- Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robotishappy.com/2010/08/finally-back-to-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

