<?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>I am ShadowLord&#187; arduino</title>
	<atom:link href="http://iamshadowlord.com/tag/arduino/feed" rel="self" type="application/rss+xml" />
	<link>http://iamshadowlord.com</link>
	<description>Interesting to me</description>
	<lastBuildDate>Fri, 20 Jan 2012 23:48:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CheerLights: my lights are linked to everyone else&#8217;s</title>
		<link>http://iamshadowlord.com/2011/12/cheerlights-my-lights-are-linked-to-everyone-elses.html</link>
		<comments>http://iamshadowlord.com/2011/12/cheerlights-my-lights-are-linked-to-everyone-elses.html#comments</comments>
		<pubDate>Thu, 01 Dec 2011 18:08:02 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[CheerLights]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iobridge]]></category>
		<category><![CDATA[thingspeak]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[web of things]]></category>

		<guid isPermaLink="false">http://iamshadowlord.com/?p=368</guid>
		<description><![CDATA[If you have been following my projects for the last 12 years, you probably figured out that I must have a master plan. And this plan involves connecting things to the Internet that may or may not turn against us in the future. Way back in 2001, my partners and I released FuzzBox &#8211; this technology allowed for artificial [...]]]></description>
			<content:encoded><![CDATA[<p>If you have been following my projects for the last 12 years, you probably figured out that I must have a master plan. And this plan involves connecting things to the Internet that may or may not turn against us in the future. Way back in 2001, my partners and I released <a title="Tangent Research Announces Web-based Gateway to Artificial Intelligence System" href="http://tangentresearch.com/news/07252001_p2p_ai.html" target="_blank">FuzzBox</a> &#8211; this technology allowed for artificial intelligence to be distributed to devices via the Web. Our thoughts were if the decision making could be made on the Internet the devices themselves could focus on their task vs. trying to be a super device on their own. This was way early on and the ideas were premature, but it started a series of events and failures that led to even more projects involving devices linked together over the web. I guess this is now called, &#8220;<a title="Internet of Things Projects on the ioBridge blog" href="http://blog.iobridge.com/tag/internet-of-things/" target="_blank">The Internet of Things</a>&#8220;.</p>
<p>Something that has emerged over the years is social networking. I have been fascinated by the idea of collective intelligence. It&#8217;s fun to follow a football game on Twitter or on Facebook&#8217;s live stream. You get to see the take other&#8217;s have on the same event that you are experiencing. If the Steelers score, you can feel it reverberate through social networks. These networks only work if there is lots of participation by many people. I have heard that people have predicted STD out breaks from Twitter status updates, food poisoning sources, and even where earthquakes have taken place. This is fascinating to me.</p>
<p>The results are two-fold: you can learn from this data and that we are all connected. Enter in, <a title="Socially aware lights -- CheerLights" href="http://www.cheerlights.com" target="_blank">CheerLights</a> &#8211; CheerLights is my combination of distributed devices with social networking. This project that involves connecting multicolored lights to other people&#8217;s lights and allow Twitter keywords control them all. If someone <a title="CheerLights on Twitter" href="http://www.twitter.com/cheerlights" target="_blank">tweets</a>, &#8220;@cheerlights let&#8217;s go green&#8221; &#8211; every light connected to the project would change to green. To me this is a physical representation of a social network trending topic. It&#8217;s a way to share a moment in that moment. Just like with social networking, CheerLights requires scale to be very interesting.  If you check out CheerLights.com, you will see how to build a set of lights that are linked together with other people&#8217;s lights via Twitter. I have examples using things from ioBridge, Arduino, and Digi. Please let me know if you decide to build something and connect it to <a title="Twitter reactive lights -- CheerLights" href="http://www.cheerlights.com" target="_blank">CheerLights</a>.</p>
<p>We are all connected. That&#8217;s my purpose for building all of this technology. Nothing else matters.</p>
<p style="text-align: center;">
<p><a href="http://www.youtube.com/watch?v=yqi28Qcvvdg&#038;fmt=18">www.youtube.com/watch?v=yqi28Qcvvdg</a></p></p>
]]></content:encoded>
			<wfw:commentRss>http://iamshadowlord.com/2011/12/cheerlights-my-lights-are-linked-to-everyone-elses.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet of Things Talk at Carnegie Mellon University</title>
		<link>http://iamshadowlord.com/2011/10/internet-of-things-talk-at-carnegie-mellon-university-for-the-pittsburgh-perl-workshop.html</link>
		<comments>http://iamshadowlord.com/2011/10/internet-of-things-talk-at-carnegie-mellon-university-for-the-pittsburgh-perl-workshop.html#comments</comments>
		<pubDate>Wed, 12 Oct 2011 02:32:52 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[Talks]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[internet of things]]></category>
		<category><![CDATA[iobridge]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PGHPW]]></category>
		<category><![CDATA[PPW]]></category>
		<category><![CDATA[web of things]]></category>

		<guid isPermaLink="false">http://iamshadowlord.com/?p=327</guid>
		<description><![CDATA[Last weekend was the Pittsburgh Perl Workshop hosted by Carnegie Mellon University in Pittsburgh, PA. I gave a talk on the Internet of Things and building apps using the Perl programming language as the connective tissue between devices and web applications. I covered the basics on how you interface devices to the real-world. I also [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend was the <a title="Pittsburgh Perl Workshop" href="http://pghpw.org/ppw2011/" target="_blank">Pittsburgh Perl Workshop</a> hosted by Carnegie Mellon University in Pittsburgh, PA. I gave a talk on the Internet of Things and building apps using the Perl programming language as the connective tissue between devices and web applications. I covered the basics on how you interface devices to the real-world. I also hosted a Hardware Hackathon and got to discuss hardware, connecting things, and Perl. I introduced everyone to my <a title="Everything is a Remix" href="http://www.everythingisaremix.info" target="_blank">remixed</a> theory of innovation. Just get out there and copy a well documented project, learn by transforming some part of the project, and combine it with other ideas. This is the only way innovation has ever happened&#8230; Thanks for the awesome time at PPW!</p>
<p><a href="http://pghpw.org/ppw2011/"><img class="aligncenter size-full wp-image-331" title="Hans Scharler at the 2011 Pittsburgh Perl Workshop" src="http://iamshadowlord.com/wp-content/uploads/2011/10/PPW2011-2-small.jpg" alt="Hans Scharler at the 2011 Pittsburgh Perl Workshop" width="500" height="205" /></a></p>
<p>Here are my slides from the 2011 Pittsburgh Perl Workshop:</p>
<p style="text-align: center;"><iframe src="http://www.slideshare.net/slideshow/embed_code/9638095" width="400" height="337" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://iamshadowlord.com/2011/10/internet-of-things-talk-at-carnegie-mellon-university-for-the-pittsburgh-perl-workshop.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TouchShield Slide Two-way Communications</title>
		<link>http://iamshadowlord.com/2010/03/touchshield-slide-two-way-communications.html</link>
		<comments>http://iamshadowlord.com/2010/03/touchshield-slide-two-way-communications.html#comments</comments>
		<pubDate>Sun, 21 Mar 2010 09:26:57 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[TouchShield Slide]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[liquidware]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[serial]]></category>

		<guid isPermaLink="false">http://iamshadowlord.com/?p=118</guid>
		<description><![CDATA[Over last summer, I got the GamePack from Liquidware which includes a touch screen display, joystick, microcontroller, and battery pack. With this kit you can make a GameBoy from scratch. With some blood, sweat, and tears, I was able to re-create some games like Asteroids and Tetris. The touch screen is called the TouchShield Slide [...]]]></description>
			<content:encoded><![CDATA[<p>Over last summer, I got the <a title="Game Kit from Liquid Ware" href="http://www.liquidware.com/shop/show/GMP/GamePack" target="_blank">GamePack</a> from Liquidware which includes a touch screen display, joystick, microcontroller, and battery pack. With this kit you can make a GameBoy from scratch. With some blood, sweat, and tears, I was able to re-create some games like <a title="Asteriods game for TouchShield Slide and InputShield from LiquidWare" href="http://www.liquidware.com/apps/show/73" target="_blank">Asteroids</a> and Tetris.</p>
<p>The touch screen is called the TouchShield Slide which is a 320×240 OLED and resistive touch screen. The screen also has a microcontroller that is Arduino compatible and expands your program space. Since the screen is really a microcontroller in disguise, it can be used for many types of projects. Overall I am very happy with the screen, but I realized I didn&#8217;t know how to use it very well. I set out to learn and develop a protocol / reusable library that allows the screen to talk to a microcontroller and vice-verse. So I wanted to take a moment and explain what I learned &#8211; maybe you can get going faster than I did.</p>
<p><em><strong>The Goal</strong></em></p>
<p>My goal is to be able to display data on the screen that has been received from another device. The data requested would be initiated by a touch on the screen. The protocol has to be consistent and reliable, while being flexible enough to be the basis for future projects.</p>
<div id="attachment_119" class="wp-caption aligncenter" style="width: 556px"><a title="TouchShield Slide Touch Screen, OLED display at Liquidware" href="http://www.liquidware.com/shop/show/TSL/TouchShield+Slide" target="_blank"><img class="size-full wp-image-119" title="Touch -&gt; TouchShield Slide -&gt; Arduino -&gt; TouchShield Slide" src="http://iamshadowlord.com/wp-content/uploads/2010/03/System-Overview.jpg" alt="Touch -&gt; TouchShield Slide -&gt; Arduino -&gt; TouchShield Slide" width="546" height="386" /></a><p class="wp-caption-text">Touch -&gt; TouchShield Slide -&gt; Arduino -&gt; TouchShield Slide</p></div>
<p><strong><em>Programming Tips and Tricks</em></strong></p>
<p>I found quite a few libraries and resources on <a title="TouchShield wiki" href="http://www.liquidware.com/wikipages/name/TouchShield" target="_blank">liquidware.com</a>.  I also discovered quite a few important things through my trial and error. My biggest frustration was with programming and figuring out the IDE. Here are some tips.</p>
<ul>
<li>To program the screen use the <a title="Antipasto Arduino IDE" href="http://www.liquidware.com/wikipages/1" target="_blank">Antipasto Arduino / Aardvark IDE</a></li>
<li>Program the screen and Arduino separately - make sure the IDE has the proper device selected</li>
<li>To put the screen in program mode, press the switch beside the power connector &#8211; it&#8217;s in program mode when the LED on the backside is red</li>
</ul>
<p><strong><em>TouchShield Slide Serial</em></strong></p>
<p>Serial data sent and received by the TouchShield Slide uses the hardware serial lines.</p>
<p>To setup the serial connection, place this line in your setup code block:</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:580px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">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></div></div>
<p>Now you can read and write to and from the serial buffer. To read in a whole string, use a byte array to store bytes from the serial buffer when serial data is available. To write to the serial buffer, simply use serial print.</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:580px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">char</span> charIn <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
byte i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #993333;">char</span> stringIn<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">32</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
charIn <span style="color: #339933;">=</span> Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
stringIn<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> charIn<span style="color: #339933;">;</span><br />
i <span style="color: #339933;">+=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;A&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><strong><em>Arduino Serial</em></strong></p>
<p>On the Arduino side, you have to use some form of Software Serial that sends and receives data on Pins 2/3. I have found that the Adafruit SoftSerial Library, &#8220;AFSoftSerial.h&#8221;, works the best. It seems to be reliable and produce consistent results when talking to the TouchShield Slide. Reading and writing from a software  serial buffer is about the same as a hardware one with this library.</p>
<p>To use software serial, follow these steps:</p>
<ul>
<li>Include the &#8220;AFSoftSerial.h&#8221; library in your Arduino code header space</li>
<li>Define the RX and TX pins</li>
<li>Instantiate the software serial</li>
<li>Initiate the software serial line</li>
</ul>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:580px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#include &lt;AFSoftSerial.h&gt;</span><br />
<br />
<span style="color: #339933;">#define RX_PIN &nbsp;3</span><br />
<span style="color: #339933;">#define TX_PIN &nbsp;2</span><br />
<br />
AFSoftSerial touchSerial <span style="color: #339933;">=</span> &nbsp;AFSoftSerial<span style="color: #009900;">&#40;</span>RX_PIN<span style="color: #339933;">,</span> TX_PIN<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<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><br />
touchSerial.<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><br />
<span style="color: #009900;">&#125;</span></div></div>
<p><em><strong>Demo Project</strong></em></p>
<p>I took a moment to put together all of the things that I learned into a quick demo project. This project displays a random number on the screen. The random number is being generated by an Arduino, sent via serial, and requested by a touch of the TouchShield Slide.</p>
<p>Visit Liquidware&#8217;s <a title="Liquidware App Store" href="http://www.liquidware.com/apps/show/80" target="_blank">App Store</a> to download the source code and library for this demo project.</p>
<div id="attachment_122" class="wp-caption aligncenter" style="width: 506px"><a title="Download the project source code from the app store liquidware.com" href="http://www.liquidware.com/apps/show/80" target="_blank"><img class="size-full wp-image-122 " title="Random Number from Arduino Displayed after Detecting a Touch" src="http://iamshadowlord.com/wp-content/uploads/2010/03/Touch.jpg" alt="Random Number from Arduino Displayed after Detecting a Touch" width="496" height="297" /></a><p class="wp-caption-text">Random Number from Arduino Displayed after Detecting a Touch</p></div>
]]></content:encoded>
			<wfw:commentRss>http://iamshadowlord.com/2010/03/touchshield-slide-two-way-communications.html/feed</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Internet-enabled Message Center</title>
		<link>http://iamshadowlord.com/2009/06/internet-enabled-message-center.html</link>
		<comments>http://iamshadowlord.com/2009/06/internet-enabled-message-center.html#comments</comments>
		<pubDate>Mon, 15 Jun 2009 01:10:00 +0000</pubDate>
		<dc:creator>Hans</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iobridge]]></category>
		<category><![CDATA[liquidware]]></category>
		<category><![CDATA[stock quote]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[usb power cable]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://iamshadowlord.com/?p=22</guid>
		<description><![CDATA[What are you up to now? I took the leap and bought an Arduino from LiquidWare. An arduino is an open-source microcontroller that has a processor, some digital I/O pins, and analog inputs. You can create little standalone programs that monitor inputs, control LEDs, and pretty much anything that you dream up. My favorite projects [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iamshadowlord.com/uploaded_images/Message-Center-720680.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 235px;" src="http://www.iamshadowlord.com/uploaded_images/Message-Center-720659.jpg" border="0" alt="" /></a></p>
<div><strong>What are you up to now?</strong></div>
<p>I took the leap and bought an Arduino from <a href="http://www.liquidware.com/">LiquidWare</a>. An arduino is an open-source microcontroller that has a processor, some digital I/O pins, and analog inputs. You can create little standalone programs that monitor inputs, control LEDs, and pretty much anything that you dream up. My favorite projects are ones that involve the Internet. A microcontroller is rather simple by itself, but what if it could use the web to get answers, send email, maybe update my Twitter status? That means there is a unlimited number of projects ahead &#8211; Microcontrollers collaboarating in cyberspace. The missing link for the web part is the <a href="http://www.iobridge.com/">ioBridge IO-204</a>. I know you are no stranger to the the IO-204, but for those of you who have not heard. The IO-204 sits on my network and relays data from its channels to ioBridge.com servers and back into my network. It allows for remote control and monitoring without network configuration and programming. One of the expansion boards is a two-way serial board that accepts serial strings and connects them to APIs of web services that ioBridge interfaces to and sends back responses. For instance, I can send the commands, &#8220;[[[calc|9*9]]]&#8221; and this returns 81. OK, maybe not impressive on the surface, but that result came from Google Calculator. Anything <a href="http://www.google.com/help/calculator.html">Google Calculator</a> can solve, your microcontroller has access to those results. For more examples, visit the <a href="http://www.iobridge.net/wiki/api/serial-web-services-api">Serial Web Services API</a> on the wiki.</p>
<div><strong>Message Center Project</strong></div>
<div>I wanted to combine these two worlds with a sample project &#8211; maybe it will inspire you to come up with something better, spark some ideas that you have. I have my arduino measuring my outside temperature here in Pittsburgh, which is an analog input scaled to Fahrenheit. At any moment I can press a button and get the temperature on the LCD screen &#8211; no Internet required. Since I have been planning a work trip to Atlanta, I also wanted to compare my temperature with hot-lanta&#8217;s. So, my project solves that. Using the &#8220;weather command&#8221;, I am able to get the weather anywhere in the world by zip code or city name.</div>
<div>I added a few more things to the message center. With another button I can get the stock quote of Google. My strike price was $405, so I have been watching it close. If it gets below $405, I get an automatic email from my message center. The stock quote comes from the Yahoo Financials API.</div>
<div>
<div style="text-align: left;">I have one more button that emails me a secret message when it&#8217;s pressed. I put this in here for when my mom comes into my room from when I am on the road. It&#8217;s aptly label, do not press. Next time, I will hook it to a light sensor in the basement to catch her when she turns on my lights. I am sure you all have the same issues with your mom.</div>
<div style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/LNcspcEdak8&amp;hl=en&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/LNcspcEdak8&amp;hl=en&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></div>
<div style="text-align: center;"><strong><br />
</strong></div>
<div style="text-align: left;"><strong>Source Code</strong></div>
<div>The arduino requires some c-like programming and I wanted to include the sketch for you to steal and use for your projects. You will see how I send the serial commands from the arduino to the IO-204 using the UART serial connection (pins 0/1) and recieve and parse the incoming results. I use a SoftwareSerial port for the LCD results. The push buttons are software debounced and use pull-up resistors for solid digital connections. The LED&#8217;s linked to each button use a 330 ohm resistor to protect them. I was aided by the Arduino Inputs tutorial on <a href="http://www.ladyada.net/learn/arduino/lesson5.html">Ladyada.net</a>, <a href="http://www.arduino.cc/en/Tutorial/Debounce">Debounce Tutorial</a>, and the <a href="http://www.iobridge.net/wiki">iobridge Wiki</a> / <a href="http://www.iobridge.net/forum">Forum</a>. Please let me know if you have any questions, maybe I can help. I have learned a lot about handling strings on the arduino.</div>
<div>
<pre><span style="color: #777755;">//
</span><span style="color: #777755;">// Message Center using Arduino and the ioBridge IO-204</span><span style="color: #777755;">
//
</span><span style="color: #777755;">// An open-souce Shadowlord Project</span><span style="color: #777755;">
// www.IamShadowlord.com</span>

#include &lt;<span style="color: #cc6600;">SoftwareSerial</span>.h&gt;

<span style="color: #777755;">// SoftwareSerial Pins
</span>#define rxPin 2
#define txPin 3

<span style="color: #777755;">// Setup Software Serial</span><span style="color: #cc6600;">
SoftwareSerial</span> softSerial = <span style="color: #cc6600;">SoftwareSerial</span>(rxPin, txPin);

<span style="color: #777755;">// Global Setup
</span><span style="color: #996600;">int</span> middleLED = 11;
<span style="color: #996600;">int</span> rightLED = 10;
<span style="color: #996600;">int</span> leftLED = 12;

<span style="color: #996600;">int</span> leftButton = 5;<span style="color: #996600;">
int</span> leftButtonCurrent = <span style="color: #cc0000;">LOW</span>;
<span style="color: #996600;">int</span> leftButtonReading;
<span style="color: #996600;">int</span> leftButtonPrevious = <span style="color: #cc0000;">HIGH</span>;
<span style="color: #996600;">long</span> leftButtonTime = 0;<span style="color: #996600;">
long</span> leftButtonDebounce = 200;

<span style="color: #996600;">int</span> middleButton = 4;
<span style="color: #996600;">int</span> middleButtonCurrent = <span style="color: #cc0000;">LOW</span>;
<span style="color: #996600;">int</span> middleButtonReading;<span style="color: #996600;">
int</span> middleButtonPrevious = <span style="color: #cc0000;">HIGH</span>;
<span style="color: #996600;">long</span> middleButtonTime = 0;<span style="color: #996600;">
long</span> middleButtonDebounce = 200;

<span style="color: #996600;">int</span> rightButton = 6;<span style="color: #996600;">
int</span> rightButtonCurrent = <span style="color: #cc0000;">LOW</span>;
<span style="color: #996600;">int</span> rightButtonReading;<span style="color: #996600;">
int</span> rightButtonPrevious = <span style="color: #cc0000;">HIGH</span>;<span style="color: #996600;">
long</span> rightButtonTime = 0;<span style="color: #996600;">
long</span> rightButtonDebounce = 200;

<span style="color: #996600;">int</span> tempPin = 5;
<span style="color: #996600;">int</span> tempAnalog = 0;<span style="color: #996600;">
int</span> tempF = 0;

<span style="color: #996600;">char</span>* currentRequest = <span style="color: #cc0000;">""</span>;

<span style="color: #777755;">// Start up program</span><span style="color: #cc6600;">
void</span> <span style="color: #993300;"><strong>setup</strong></span>() {

<span style="color: #996600;">pinMode</span>(rxPin, <span style="color: #cc0000;">INPUT</span>);
<span style="color: #996600;">pinMode</span>(txPin, <span style="color: #cc0000;">OUTPUT</span>);

<span style="color: #996600;">pinMode</span>(leftLED, <span style="color: #cc0000;">OUTPUT</span>);<span style="color: #996600;">
pinMode</span>(middleLED, <span style="color: #cc0000;">OUTPUT</span>);
<span style="color: #996600;">pinMode</span>(rightLED, <span style="color: #cc0000;">OUTPUT</span>);

<span style="color: #996600;">pinMode</span>(leftButton, <span style="color: #cc0000;">INPUT</span>);
<span style="color: #996600;">pinMode</span>(middleButton, <span style="color: #cc0000;">INPUT</span>);
<span style="color: #996600;">pinMode</span>(rightButton, <span style="color: #cc0000;">INPUT</span>);

softSerial.<span style="color: #996600;">begin</span>(9600);
<span style="color: #996600;">delay</span>(100);

<span style="color: #996600;">Serial</span>.<span style="color: #996600;">begin</span>(9600);<span style="color: #996600;">
delay</span>(100);

<span style="color: #996600;">Serial</span>.<span style="color: #996600;">flush</span>();
<span style="color: #996600;">delay</span>(100);

<span style="color: #777755;">// Setup LCD</span>
clearLCD();
setBacklightBrightness(9);<span style="color: #996600;">
delay</span>(1000);

<span style="color: #777755;">// Test LEDs</span><span style="color: #996600;">
digitalWrite</span>(leftLED, <span style="color: #cc0000;">HIGH</span>);
<span style="color: #996600;">digitalWrite</span>(middleLED, <span style="color: #cc0000;">HIGH</span>);
<span style="color: #996600;">digitalWrite</span>(rightLED, <span style="color: #cc0000;">HIGH</span>);

<span style="color: #996600;">delay</span>(1500);

<span style="color: #996600;">digitalWrite</span>(leftLED, <span style="color: #cc0000;">LOW</span>);<span style="color: #996600;">
digitalWrite</span>(middleLED, <span style="color: #cc0000;">LOW</span>);<span style="color: #996600;">
digitalWrite</span>(rightLED, <span style="color: #cc0000;">LOW</span>);

}

<span style="color: #777755;">// Start main program loop</span><span style="color: #cc6600;">
void</span> <span style="color: #993300;"><strong>loop</strong></span>(){

<span style="color: #777755;">// Get Analog Input and scale as temperature for ioBridge temperature sensor on arduino
</span>tempAnalog = <span style="color: #996600;">analogRead</span>(tempPin);
tempF = tempAnalog / 6.875;

<span style="color: #777755;">// Monitor left button status and debounce
</span>leftButtonReading = <span style="color: #996600;">digitalRead</span>(leftButton);

<span style="color: #cc6600;">if</span> (leftButtonReading == <span style="color: #cc0000;">HIGH</span> &amp;&amp; leftButtonPrevious == <span style="color: #cc0000;">LOW</span> &amp;&amp; <span style="color: #996600;">
          millis</span>() - leftButtonTime &gt; leftButtonDebounce) {
<span style="color: #cc6600;">if</span> (leftButtonCurrent == <span style="color: #cc0000;">HIGH</span>) leftButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #cc6600;">
else</span> {<span style="color: #996600;">digitalWrite</span>(leftLED, <span style="color: #cc0000;">HIGH</span>);
clearLCD();<span style="color: #996600;">
delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Outside: "</span>);<span style="color: #996600;">
delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(tempF);<span style="color: #996600;">
delay</span>(100);
moveCursor(<span style="color: #cc0000;">"02"</span>, <span style="color: #cc0000;">"01"</span>);
<span style="color: #996600;">delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Atlanta: "</span>);
leftButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #777755;">
//Request temperature in Atlanta via ioBridge
</span><span style="color: #996600;">Serial</span>.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"[[[weather|Atlanta]]]"</span>);<span style="color: #996600;">
digitalWrite</span>(leftLED, <span style="color: #cc0000;">LOW</span>);
}
leftButtonTime = <span style="color: #996600;">millis</span>();
}

leftButtonPrevious = leftButtonReading;

<span style="color: #777755;">// Monitor middle button status and debounce</span>
middleButtonReading = <span style="color: #996600;">digitalRead</span>(middleButton);

<span style="color: #cc6600;">if</span> (middleButtonReading == <span style="color: #cc0000;">HIGH</span> &amp;&amp; middleButtonPrevious == <span style="color: #cc0000;">LOW</span> &amp;&amp;
         <span style="color: #996600;">millis</span>() - middleButtonTime &gt; middleButtonDebounce) {
<span style="color: #cc6600;">if</span> (middleButtonCurrent == <span style="color: #cc0000;">HIGH</span>) middleButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #cc6600;">
else</span> {currentRequest = <span style="color: #cc0000;">"Google"</span>;<span style="color: #996600;">
digitalWrite</span>(middleLED, <span style="color: #cc0000;">HIGH</span>);
clearLCD();<span style="color: #996600;">delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"GOOG: $"</span>);<span style="color: #996600;">
delay</span>(100);
middleButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #777755;">
//Request Google Stock Price via ioBridge  </span><span style="color: #996600;">
Serial</span>.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"[[[stock|GOOG]]]"</span>); <span style="color: #996600;">
digitalWrite</span>(middleLED, <span style="color: #cc0000;">LOW</span>);
}
middleButtonTime = <span style="color: #996600;">millis</span>();
}

middleButtonPrevious = middleButtonReading;

<span style="color: #777755;">// Monitor right button status and debounce
</span>rightButtonReading = <span style="color: #996600;">digitalRead</span>(rightButton);

<span style="color: #cc6600;">if</span> (rightButtonReading == <span style="color: #cc0000;">HIGH</span> &amp;&amp; rightButtonPrevious == <span style="color: #cc0000;">LOW</span> &amp;&amp;
            <span style="color: #996600;">millis</span>() - rightButtonTime &gt; rightButtonDebounce) {<span style="color: #cc6600;">
if</span> (rightButtonCurrent == <span style="color: #cc0000;">HIGH</span>) rightButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #cc6600;">
else</span> {<span style="color: #996600;">
digitalWrite</span>(rightLED, <span style="color: #cc0000;">HIGH</span>);
clearLCD();
<span style="color: #996600;">delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Alert: "</span>);<span style="color: #996600;">
delay</span>(100);
rightButtonCurrent = <span style="color: #cc0000;">LOW</span>;<span style="color: #777755;">
//Send email via ioBridge  </span><span style="color: #996600;">
Serial</span>.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"[[[email|hans@nothans.com|Alert|Mom, is pressing your buttons]]]"</span>);
<span style="color: #996600;">digitalWrite</span>(rightLED, <span style="color: #cc0000;">LOW</span>);
}
rightButtonTime = <span style="color: #996600;">millis</span>();
}

rightButtonPrevious = rightButtonReading;

<span style="color: #777755;">// Display serial messages
</span><span style="color: #cc6600;">if</span>(<span style="color: #996600;">Serial</span>.<span style="color: #996600;">available</span>() &gt; 0){

<span style="color: #996600;">delay</span>(100);

<span style="color: #996600;">char</span> charIn = 0;
<span style="color: #996600;">byte</span> i = 0;<span style="color: #996600;">
char</span> stringIn[32] = <span style="color: #cc0000;">""</span>;

<span style="color: #cc6600;">while</span>(<span style="color: #996600;">Serial</span>.<span style="color: #996600;">available</span>()) {
charIn = <span style="color: #996600;">Serial</span>.<span style="color: #996600;">read</span>();
stringIn[i] = charIn;
i += 1;
}

<span style="color: #cc6600;">if</span> (currentRequest == <span style="color: #cc0000;">"Google"</span>) {

softSerial.<span style="color: #996600;">print</span>(stringIn);
<span style="color: #996600;">int</span> stockPrice = atoi(stringIn);
<span style="color: #996600;">delay</span>(100);
moveCursor(<span style="color: #cc0000;">"02"</span>, <span style="color: #cc0000;">"01"</span>);
<span style="color: #996600;">delay</span>(100);
stockPrice = stockPrice - 405;
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Change: $"</span>); <span style="color: #996600;">
delay</span>(100);
softSerial.<span style="color: #996600;">print</span>(stockPrice);
currentRequest = <span style="color: #cc0000;">""</span>;

}<span style="color: #cc6600;">
else</span>softSerial.<span style="color: #996600;">print</span>(stringIn);
}

<span style="color: #777755;">// End program loop     </span>
}

<span style="color: #777755;">//</span><span style="color: #777755;">
// ioBridge Serial LCD Functions and Parameters (for SoftwareSerial)
</span><span style="color: #777755;">//</span>

<span style="color: #cc6600;">void</span> displayMessage(<span style="color: #996600;">char</span>* message){
softSerial.<span style="color: #996600;">print</span>(message);
}

<span style="color: #cc6600;">void</span> clearLCD(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Z"</span>);
}

<span style="color: #cc6600;">void</span> setBacklightBrightness(<span style="color: #996600;">int</span> level){<span style="color: #777755;">
// level
</span><span style="color: #777755;">// 0=Off -&gt; 9=Brightest</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"B"</span>);
softSerial.<span style="color: #996600;">print</span>(level);
}

<span style="color: #cc6600;">void</span> setBacklightTime(<span style="color: #996600;">int</span> level, <span style="color: #996600;">byte</span> seconds){<span style="color: #777755;">
// level
</span><span style="color: #777755;">// 0=Off -&gt; 9=Brightest</span>

<span style="color: #777755;">// seconds</span><span style="color: #777755;">
// 01 = 1 seconds =&gt; 06 = 60 seconds</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"T"</span>);
softSerial.<span style="color: #996600;">print</span>(level);
softSerial.<span style="color: #996600;">print</span>(seconds, <span style="color: #cc0000;">BYTE</span>);
}

<span style="color: #cc6600;">void</span> moveCursorHome(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"H"</span>);
}

<span style="color: #cc6600;">void</span> turnCursorOn(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"J"</span>);
}

<span style="color: #cc6600;">void</span> turnCursorOff(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"K"</span>);
}

<span style="color: #cc6600;">void</span> turnBlinkingCursorOn(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"P"</span>);
}

<span style="color: #cc6600;">void</span> turnBlinkingCursorOff(){
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"Q"</span>);
}

<span style="color: #cc6600;">void</span> scrollMessage(<span style="color: #996600;">int</span> row, <span style="color: #996600;">int</span> <span style="color: #996600;">speed</span>, <span style="color: #996600;">char</span>* message){
<span style="color: #777755;">// row</span><span style="color: #777755;">
// 1=First Line -&gt; 2=Second Line</span>

<span style="color: #777755;">// speed</span><span style="color: #777755;">
// 0=Slowest -&gt; 9=Fastest</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"S"</span>);
softSerial.<span style="color: #996600;">print</span>(row);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #996600;">speed</span>);
softSerial.<span style="color: #996600;">print</span>(message);
softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
}

<span style="color: #cc6600;">void</span> moveCursor(<span style="color: #996600;">char</span>* row, <span style="color: #996600;">char</span>* column){
<span style="color: #777755;">// row
</span><span style="color: #777755;">// 01=First Line -&gt; 02=Second Line</span>

<span style="color: #777755;">// column</span><span style="color: #777755;">
// 01=First Position -&gt; 16=Last Position</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"L"</span>);
softSerial.<span style="color: #996600;">print</span>(row);
softSerial.<span style="color: #996600;">print</span>(column);
}

<span style="color: #cc6600;">void</span> drawHorizontalGauge(<span style="color: #996600;">int</span> row, <span style="color: #996600;">char</span>* leftLabel, <span style="color: #996600;">char</span>* rightLabel, <span style="color: #996600;">char</span>* length){<span style="color: #777755;">
// row
</span><span style="color: #777755;">// 1=First Line -&gt; 2=Second Line</span>

<span style="color: #777755;">// leftLabel and rightLabel
</span><span style="color: #777755;">// 2 character labels</span>

<span style="color: #777755;">// length</span><span style="color: #777755;">
// a=Empty -&gt; k=Full (filled in from left to right)</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"G"</span>);
softSerial.<span style="color: #996600;">print</span>(row);
softSerial.<span style="color: #996600;">print</span>(leftLabel);
softSerial.<span style="color: #996600;">print</span>(rightLabel);
softSerial.<span style="color: #996600;">print</span>(length);
}

<span style="color: #cc6600;">void</span> drawVerticalGauge(<span style="color: #996600;">int</span> <span style="color: #996600;">height</span>){<span style="color: #777755;">
// height
</span><span style="color: #777755;">// 0=Bottom -&gt; 8=Top (filled in from bottom to top)</span>

softSerial.<span style="color: #996600;">print</span>(0xFE, <span style="color: #cc0000;">BYTE</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #cc0000;">"V"</span>);
softSerial.<span style="color: #996600;">print</span>(<span style="color: #996600;">height</span>);

}</pre>
</div>
<div><span style="font-weight: bold;">Bonus Project</span></div>
<div>
<p>It&#8217;s simple, but I hacked together a power supply for the Arduino, which gets power from USB or a coaxial input from a transformer. I wanted to only run one brick, wall wart, so I hacked a USB cable. There are 4 wires in the USB cable (from <a href="http://pinouts.ru/Slots/USB_pinout.shtml">pinouts.ru</a>):</p>
</div>
<table style="font-size: 10pt; border-collapse: collapse; border-color: black;" border="1" cellspacing="0" cellpadding="3" width="50%">
<tbody style="font-size: 10pt;">
<tr style="font-size: 10pt;">
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">1</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">VCC</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Red</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">+5 VDC</td>
</tr>
<tr style="font-size: 10pt;">
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">2</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">D-</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">White</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Data -</td>
</tr>
<tr style="font-size: 10pt;">
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">3</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">D+</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Green</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Data +</td>
</tr>
<tr style="font-size: 10pt;">
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">4</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">GND</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Black</td>
<td style="font-size: 10pt; padding-top: 5px; padding-bottom: 5px; border-color: #808080;">Ground</td>
</tr>
</tbody>
</table>
<div>The IO-204 has a regulated 5VDC and ground (up to 1A &#8211; 4A total draw depending on supply) on each channel, so using a terminal strip, I connected the VCC and GND to a cut in half USB cable.</div>
<p><a href="http://www.iamshadowlord.com/uploaded_images/Arduino-USB-Power-Cable-798046.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 347px; height: 400px;" src="http://www.iamshadowlord.com/uploaded_images/Arduino-USB-Power-Cable-798028.jpg" border="0" alt="" /></a></p>
<div>It&#8217;s magic &#8211; look ma, only one power source.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://iamshadowlord.com/2009/06/internet-enabled-message-center.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

