<?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>unthink media &#187; Physical Computing</title>
	<atom:link href="http://blog.unthinkmedia.com/category/programing/physcomp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.unthinkmedia.com</link>
	<description>creativity + technology</description>
	<lastBuildDate>Wed, 11 Jan 2012 22:20:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Prototyping a Networked Family</title>
		<link>http://blog.unthinkmedia.com/2010/09/27/prototyping-a-networked-family/</link>
		<comments>http://blog.unthinkmedia.com/2010/09/27/prototyping-a-networked-family/#comments</comments>
		<pubDate>Mon, 27 Sep 2010 16:40:50 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[product design]]></category>
		<category><![CDATA[toy]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=762</guid>
		<description><![CDATA[Being a first time dad has been the most amazing experience of my life. Watching my daughter grow, and witnessing her constant exploration of the world around her has been extraordinary. Unfortunately when Mondays roll around, it is time for me and many other parents to drop off our kids at the babysitter.  The amount [...]]]></description>
			<content:encoded><![CDATA[<p>Being a first time dad has been the most amazing experience of my life. Watching my daughter grow, and witnessing her constant exploration of the world around her has been extraordinary. Unfortunately when Mondays roll around, it is time for me and many other parents to drop off our kids at the babysitter.  The amount of time we get to interact with each other is very minimal, and pretty sad.</p>
<p>In a world where we all feel so &#8220;connected&#8221;, the people that matter most have no method of remotely interacting with us.  My 1 1/2 year has no twitter, or Facebook account to update.  She doesn&#8217;t check into fourSquare every time we go to grandma&#8217;s house. Even with mobile phones and Skype video conferencing, there is no direct method of me interacting with her without the assistance and supervision of an adult.  So basically, we could only interact with each other when another adult has both the time and is willing to put in the effort to set up an environment for us to communicate.</p>
<p>This got me thinking &#8220;how can my daughter and I interact during my work hours?&#8221;  The first thing I did was identify the main characteristics of my daughter, back when I first started working on this project:</p>
<ul>
<li>My daughter was one year old.</li>
<li>Her vocal communication ability was in the preliminary stages of development</li>
<li>Her motor skills where still not fully developed, so complex tasks like using a keyboard or mouse where not possible.</li>
<li>She needs adult assistance to use our everyday communication tools that available to us (moble and land-line phones, computers, etc).</li>
</ul>
<p>At this young age, children are extremely dependent on their parents and other adults for just about everything.  However, there are also several activities that come as naturally as breathing and eating to a child. Two of those activities that i observed where exploration and play, many times triggered by a common catalyst of curiosity.</p>
<p>Children gradually explore their environment and toys and interacted with them, mastering the new skills that they learn along the way.  Quickly they are able to identify all sorts of toy input locations which triggered various types of output, such as audio and visual feedback.<br />
<span id="more-762"></span><br />
Many people are quick to suggest that we need to expose children to computers at an early age, I don&#8217;t disagree.  However, there is no reason that we need to take a child to a some cold desk, when where they are already in-front of their toy box. Why not instead bring the computer to them, in their own natural environment, and make them available on their own terms.  Computers come in various shapes and sizes, and are all around us. In washing machines, toasters, and most of the objects we interact with on a daily basis have them.  Just look around you right now, I&#8217;m sure you would be surprised on the amount of digital technology that is surrounding you at this moment.</p>
<p>Digital toys, and interactive plush dolls are nothing new. Companies suck as Leap Frog have thrived on making toys which have been getting smarter and smarter. With the introduction of micro-controllers embedded deep inside their soft cuddly exterior, there are endless possibilities.  So that was my answer, I would prototype a interactive based toy solution, that both an adult and child could easily use to communicate with each other.  It is too easy to go into fantasy land with a project like this, so here were my self-imposed rules:</p>
<ol>
<li>The toy must not cost more then $39 retail, since that is my personal breaking point for interactive toys.</li>
<li>It must work anywhere, and not be totally dependent on a network connection.</li>
<li>The child must need zero guidance to interact with the toy.</li>
<li>The toy must promote exploration</li>
<li>There must be some learning activities.</li>
<li>I must be able to interact with the toy from my office</li>
</ol>
<h3>Putting it all Together</h3>
<p>I knew that I would like a toy that enabled &#8220;me&#8221; to interact with my child via audio or video, however I started seeing that as an obvious solution and not very cost of effective.  Why should parents be forced to buy individual toys for each person that would like to interact with the child?  My daughter has a mother, aunts, grandparents, etc. Would it be feasible of me buying one for each person?  More importantly, would the child be able to interact with such a fragmented family of toys at such an early age? What would be the total cost, $39 a piece? That is pretty steep, and won&#8217;t work as a solution in my opinion.  Taking all these questions into account gave me my &#8220;ah-ha&#8221; moment.  My family and I are part of my daughter&#8217;s social network, as exclusive as it may be. Looking at the toy as a social network would mean incorporating several functions that a typical social network would have.  I decided that the most important social network functions that my toy should support where:</p>
<ul>
<li>Avatars</li>
<li>Buddy List</li>
<li>Messaging</li>
</ul>
<h3>The Birth of my ChatterPillar</h3>
<p>I decided to go with a completely modular design, so I could play off the metaphor of a family unit.  One unit, one toy, multiple facets. Each facet containing unique actions associated to that family member.  The modular design would also allow me to add and remove modules as I please.  This allows my toy to take a very literal approach to a buddy list.  If you wanted to add a buddy you would have to physically add your buddy to the toy and vice-versa.  It also allowed for an interesting business model, add all the costly circuitry in the head (the brain) and allow for less expensive body modules to take advantage of the brains powersupply, and various other components like speakers, memory, etc.  This along with some inner circuit  communication was all i needed to create the beginnings of what turned out to be myChatterPillar.  Bellow is a video showing my initial alpha prototype of myChatterPillar in action.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/B1j7UKRttgg?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/B1j7UKRttgg?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<h3>Main Features</h3>
<p>My ChatterPillar has several features that have been incorporated into the design.  </p>
<ol>
<li>There is a photo sleeve on each of the detachable modules which serve as an avatar.</li>
<li>There are 3 audio switches. The one beneath the photo is to identify the family member, and the two on the legs is for adding any other audio, like messages, song, etc.  These audio buckets are created online by the adult via a accompanying web site, and the files are later synced to the toy via a tethered USB connection.</li>
<li>Adults could remotely communicate with the toy and send messages to it via familiar technology such as email, twitter and SMS</li>
<li>Embeded assessments to test the child&#8217;s familiarity with their family and colors.</li>
</ol>
<h3>Where to go from here</h3>
<p>My next steps are to take this toy out of it&#8217;s bread board stage, and into a more complete embodiment.  I initially looked at this project as a method of communicating with my daughter, but would be great to get it out there some day so other families could also enjoy interacting with their young children.  To be continued&#8230;.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/09/27/prototyping-a-networked-family/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=762&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/09/27/prototyping-a-networked-family/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Lessons Learned: Designing Toys for Children 7months-2yrs</title>
		<link>http://blog.unthinkmedia.com/2010/06/05/lessons-learned-designing-toys-for-children-7months-2yrs/</link>
		<comments>http://blog.unthinkmedia.com/2010/06/05/lessons-learned-designing-toys-for-children-7months-2yrs/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 15:04:43 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[toys]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=693</guid>
		<description><![CDATA[I have spent the past few month deconstructing the cognitive, emotional and social attributes of children under the age of two. I have been particularly interested in understanding why children are more responsive to some toys, then they are for others. What makes a successful toy, and why? What strategies could be used in the development [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-716" title="Hugging Elmo" src="http://blog.unthinkmedia.com/wp-content/uploads/IMG_0782-225x300.jpg" alt="" width="225" height="300" /></p>
<p>I have spent the past few month deconstructing the cognitive, emotional and social attributes of children under the age of two.  I have been particularly interested in understanding why children are more responsive to some toys, then they are for others. What makes a successful toy, and why? What strategies could be used in the development of a toy to foster learning opportunities, along with several other question regarding this ripe age and this medium.</p>
<p>This age is quite interesting since you are not only designing for the child, but also for the parent, who acts as the gatekeeper. This adds an additional level of complexity, and understanding that needs to be understood. So the first question I asked myself was, &#8220;What does a parent look for in a toy?&#8221;</p>
<p>According to the book, &#8220;The Blockbuster Toys&#8221;, parents look for toys that;</p>
<ul>
<li>Child&#8217;s Safety</li>
<li>Child&#8217;s Continued Enjoyment (play value)</li>
<li>Child&#8217;s Creativity</li>
<li>Child&#8217;s Mental &amp; Physical Development</li>
<li>Child&#8217;s Success</li>
<li>Child&#8217;s Health</li>
<li>Child&#8217;s Love</li>
</ul>
<p>I added some additional bullets that I&#8217;ve noticed parents, including myself look into when purchasing a toy:<span id="more-693"></span></p>
<ul>
<li>Brand Loyalty: Parent could be very loyal to brand names.  There is a strong element of trust when a parent purchases a toy for their child.  Parent trust that Fisher-Price would not put a toy on the shelf that would be dangerous. Others may trust that Leap Frog toys will help their children become smarter.  Your options here are either try to license your toy with a company that has the brand recognition that could help proppel your toy, or make sure to market your company in a way that best reflects the goals of your merchandise.</li>
<li>Cleaning: How easy is it to clean this toy? At this age kids put toys in their mouths, and parents are sometimes extra cautious constantly cleaning their toys.</li>
<li>Durability: Will this toy sustain all the punishment that a young child puts on the toy?</li>
<li>Cost: This one really depends, but is a factor.  I some condition where other bullets such as &#8220;Child&#8217;s Continued Enjoyment&#8221; are high, parent&#8217;s may make addition investment. Your goal as a designer, should be to keep the cost as low as possible. I&#8217;ve hear that you should imagine all the parts of a toy in a bag and then multiply the cost by 4. That should give you an idea of what the on the shelf cost would be.</li>
</ul>
<p><strong>What is going on in their little heads?</strong><br />
Although each child is unique, there are some common developmental characteristics that we could use to help and identify common attributes. Through these attribute I&#8217;ve been hopping to uncover some rough guidelines to follow when creating toys for this age group.</p>
<p>Albeit, many toys on the market rely on gimmicks or piggy back on the shoulders of licensed characters to attract a child&#8217;s curiosity. However, all children have emotional needs that they expect to get fulfilled during play. According to the book <em>The Blockbuster Toy</em>, &#8220;The fulfillment of these  deep emotional needs is the fun that creates a smile&#8221; , and this results in a child&#8217;s consistent play interactions with the toy.</p>
<p>So what are some child&#8217;s emotional needs that anyone designing interaction for children in this age group should look into?</p>
<ul>
<li>Pride</li>
<li>Self-Esteem</li>
<li>Appreciation/Attention</li>
<li>Accomplishment/Mastery</li>
<li>Power/Empowerment</li>
<li>Control</li>
<li>Silliness</li>
<li>Independence/Freedom (harmless rebellion)</li>
<li>Belonging</li>
<li>Love Nurturing</li>
<li>Security</li>
<li>Fear Reduction/Bravery</li>
<li>Sensory Gratification</li>
<li>Mental and Physical Development</li>
</ul>
<p>I narrowed down this list of bullets that fall inline with the child&#8217;s development at this point. As they get older, things like fantasy and role playing also start to appear.</p>
<p><strong>What do children know at this age?</strong></p>
<p>The first place to look, is at the child&#8217;s stage of development. Jean Piaget, a Swiss epistemologist that focused his research around the development of children of this age to be in their Sensory Motor Stage of development:</p>
<blockquote><p>Sensorimotor stage: from birth to age 2. Children experience the world through movement and senses (use five senses to explore the world). During the sensorimotor stage children are extremely egocentric, meaning they cannot perceive the world from others&#8217; viewpoints. The sensorimotor stage is divided into six substages: &#8220;(1) simple reflexes; (2) first habits and primary circular reactions; (3) secondary circular reactions; (4) coordination of secondary circular reactions; (5) tertiary circular reactions, novelty, and curiosity; and (6) internalization of schemes.&#8221;</p></blockquote>
<p>Love and Security</p>
<p>Children at this stage of development need to feel safe and loved. Many of the children in the lower part of this demographic still rely solely on their mother for nourishment.  This bonding along with all the hugs and kisses they get from their parents, help a child feel the security they need to find their place in this world, and with their family. Children will sometimes show their love and nurturing to a toy doll by snuggling up with it.</p>
<p>Language</p>
<p>Children at this age <a href="http://www.npr.org/templates/transcript/transcript.php?storyId=125123354" target="_blank">recognize voices and the emotions that they convey</a>.  Although a child at this age is just beginning to create a vocabulary, they do understand much of what you are saying to them.  Like little sponges they start to develop a schema for spoken words and actions and objects. Eventually, towards the child starts to experiment with their own voice to mimic sounds.</p>
<p>Babies of this age could also identify familiar voices.  If you put mommy on speaker phone they may start looking around the room to see where mommy is.</p>
<p>This is a perfect time to give a child an opportunity to make connection and experiment with language to help with their development.  The more a toy allows a child to be vocal, the quicker they will learn how to control their vocal instrument.</p>
<p>People and Objects</p>
<p>Children at this age are good with faces. <a href="http://www.sciencedaily.com/releases/2005/01/050104114623.htm" target="_blank">Babies could recognize face structures</a> and they use physical characteristics,  characteristic expressions, postures and movements to identify specific individuals to create mental models of people. Many times, when a baby sees a photo of mommy, they could easily make the correlation between mommy and the photo, and results in a smile and excitement. This same process happens with objects that they discover and interact with, however these mental models are very generalized. Although they may know what a doggie is, they may also think a cow is doggie, or any other animal that has 4 legs.</p>
<p><strong>How do children play at this age?</strong><br />
Children at this preliminary stage of development are self-centered. They don&#8217;t do well in collaborative play since their social development has not ripened. Concepts like &#8220;sharing&#8221; do not come naturally till later in this stage, or possibly well into the following stage, depending on how quickly their socialization skills develop. Through these formative years, you will see more &#8220;parallel play&#8221;. Typically, children are in their own little world playing, even if there is another child playing right next to them. Creating a toy that requires collaboration or cooperation would probably be too advanced for this age group.</p>
<p>Structure is a &#8220;no go&#8221; with young children. They are more interested in &#8220;free play&#8221;. These children lack the cognitive ability to play a game with rules or activities that require advanced forms of interaction. Keeping it simple with clear feedback is the way to go. Simple switches with blinking lights and audio work well, but don&#8217;t feel as though that is all you could do. You could get creative and create some interesting simple interaction from a ball with an embedded tilt sensor.  As with any design limitation, it could usually be solved with creativity.</p>
<p>This age group is packed with little explorers, constantly scanning the room and objects for something to interact with.  They enjoy to the feeling of empowerment when their actions result in sort of feedback (lights, audio, parent&#8217;s laughter).  Once they discover a &#8220;cause and effect&#8221; interaction, they will sometimes continue testing their hypothesis over and over.  If you have ever seen a child that discovers how to open a kitchen cabinet, you will know what i mean. Open, close, open, close &#8230; parent buys a cabinet lock.<br />
<strong>Conclusion</strong><br />
After following all these guidelines the truth of the matter is that the toy industry is a tough to break into.  There are only a handful of successful toys that make it big each year, while thousands of others collect dust on shelves, if they get on the shelves at all.  The one piece of advice that I read though my research which really made sense is, &#8220;Do it for the smiles, not the money&#8221;.  That is the essence of toy building, before companies like Mattel and Hasbro came along, parent would create toys simply for getting the satisfaction of watching the smiles on their children&#8217;s faces. The other piece of advice is don&#8217;t get married to any idea. If you get too emotionally invested in an idea, it will not allow you to see it&#8217;s flaws. Unless you are making the toy for yourself, then you need to step back and see what of your audience&#8217;s goals you have accomplished.</p>
<p><strong>References</strong><br />
<a href="http://www.amazon.com/gp/product/0684834480?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0684834480">What Kids Buy and Why: The Psychology of Marketing to Kids</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=0684834480" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.com/gp/product/1589801229?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=1589801229">Blockbuster Toy!, The: How to Invent the Next BIG Thing</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=1589801229" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
<a href="http://www.amazon.com/gp/product/0976697327?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0976697327">Marketing to the New Super Consumer: Mom &#038; Kid</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=0976697327" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/06/05/lessons-learned-designing-toys-for-children-7months-2yrs/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=693&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/06/05/lessons-learned-designing-toys-for-children-7months-2yrs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Multi-Master Arduino Setup using i2c</title>
		<link>http://blog.unthinkmedia.com/2010/05/05/multi-master-arduino-setup-using-i2c/</link>
		<comments>http://blog.unthinkmedia.com/2010/05/05/multi-master-arduino-setup-using-i2c/#comments</comments>
		<pubDate>Wed, 05 May 2010 17:22:34 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[programing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[physical computing]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=678</guid>
		<description><![CDATA[I working on a project, I was faced with a challenge of creating a serial bus via multiple Arduino which could communicate with each other. My first intuition, after a little push in the right direction by Tom Igoe, was to create a Master/Slave setup where a Master micro-controller polls all the slave micro-controllers, and [...]]]></description>
			<content:encoded><![CDATA[<p>I working on a project, I was faced with a challenge of creating a serial bus via multiple Arduino which could communicate with each other.  My first intuition, after a little push in the right direction by <a href="http://www.tigoe.net/">Tom Igoe</a>, was to create a Master/Slave setup where a Master micro-controller polls all the slave micro-controllers, and dispatches an action. Although this answered one of my question, polling didn&#8217;t allow for complete 2-way communication.  It tuned out that the answer was mainly an oversight of my interpretation of the <a href="http://arduino.cc/en/Reference/Wire">Wire documentation</a>.</p>
<p>From Arduino Site:</p>
<blockquote><p>
Wire.begin()<br />
Wire.begin(address)<br />
====<br />
Description<br />
Initiate the Wire library and join the I2C bus as a master or slave.<br />
====<br />
Parameters<br />
address: the 7-bit slave address (optional); <strong>if not specified, join the bus as a master</strong>.<br />
====<br />
Returns<br />
none</p></blockquote>
<p>I interpreted this explanation as Wire.begin(<em>SomeAddress</em>) would default as a slave, and <strong>not</strong> be allowed to be a Master.  Being as curious, and stubborn as I typically am, i decided to forget what I thought I was being told, and instead try to break the library, so I could then see where it broke, and attempt to adjust it in a way that better suited my need. Surprise, surprise, it worked, and not need to change anything at all!  The address parameter is <em>optional</em> and defaults as a master role if no address is set. However if you do plan on sending messages to the master, you could switch speaker and listener roles via a slaves Wire.onReceive(handler) rather then polling using onRequest(handler).<span id="more-678"></span></p>
<p>I then decided to do a search on google for just &#8220;i2c&#8221;. When I clicked on the <a href="http://en.wikipedia.org/wiki/I%C2%B2C">Wikipedia entry</a> it all made sense in the first sentence of the entry summary:</p>
<blockquote><p>
I²C (Inter-Integrated Circuit) (pronounced /ˈaɪ skwɛərd ˈsiː/ or /ˈaɪ tuː ˈsiː/) is a <em>multi-master</em> serial single-ended computer bus&#8230;</p></blockquote>
<p>This basically states that no one microcontroller (unless you do not specify an address) could claim being a master at all time.  They could be bumped off their soupbox by another microcontrol and assume the role of listener/slave at anytime.
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/05/05/multi-master-arduino-setup-using-i2c/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=678&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/05/05/multi-master-arduino-setup-using-i2c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sensing Child&#8217;s Play: Examining 7 toys from the toybox</title>
		<link>http://blog.unthinkmedia.com/2010/03/27/sensing-childs-play-examining-7-toys-from-the-toybox/</link>
		<comments>http://blog.unthinkmedia.com/2010/03/27/sensing-childs-play-examining-7-toys-from-the-toybox/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 16:14:09 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[sensors]]></category>
		<category><![CDATA[toys]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=579</guid>
		<description><![CDATA[I have always had a fascination with trying to understand how the things around me work. It just so happens that after having a child, most of the thing around me are toys. Large toys, small toy, blinking lights, sounds, singing, haptics, interactivity, it is all pretty darn amazing when you sit back and really [...]]]></description>
			<content:encoded><![CDATA[<p>I have always had a fascination with trying to understand how the things around me work. It just so happens that after having a child, most of the thing around me are toys. Large toys, small toy, blinking lights, sounds, singing, haptics, interactivity, it is all pretty darn amazing when you sit back and really look at how much technology my little one year old daughter navigates and interacts with during play.  Many time when we think of children and technology we automatically think of desktop computers and video game consoles. Although all of these are examples of technology the only interaction my daughter has with them is me telling her, &#8220;don&#8217;t touch&#8221;, and handing her a toy to distract her attention.</p>
<p>I decided to take a trip to my daughter&#8217;s toy collection to examine some of the sensing capabilities that her electronic toys offer.  I will specifically focus on the toys input capabilities:</p>
<p>(At the end of the post there is a video of me trying to figure out how the LeapFrog Tag Jr works. Let me know your thoughts.)</p>
<p><strong><a href="http://www.amazon.com/gp/product/B001W1R176?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001W1R176">Fisher-Price Elmo Live Encore</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B001W1R176" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
This is by far one my daughters favorite toys.  The toy is modeled after Elmo, a Sesame Street character, which most children a quickly drawn to by his bright red color, large eyes, and youthfully fun voice.<br />
<a href="http://www.amazon.com/gp/product/B001W1R176?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001W1R176"><img src="http://blog.unthinkmedia.com/wp-content/uploads/41MJQ2ttTwL._SL500_AA300_.jpg" alt="" title="41MJQ2ttTwL._SL500_AA300_" width="300" height="300" class="alignleft size-full wp-image-593" /></a></p>
<p>Inputs</p>
<ul>
<li>Push Buttons: Typically buttons on toys are visually obvious, however Fisher Price decided to create an exploratory interaction by spreading out four button throughout the plush doll.  Three of the buttons are hidden under the fabric, on the toe, chest, and back, and the final button switch is closed by squeezing his nose.</li>
<li>Tilt Sensor: One of the nice additions that the creators added to the toy was integration of a Tilt Sensor. When Elmo falls on his side, he politely ask for help to stand backup, which is sometime accompanied with a joke.</li>
</ul>
<p><br style="clear:both;" /><br />
<span id="more-579"></span></p>
<p><strong><a href="http://www.amazon.com/gp/product/B002PHLU4G?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B002PHLU4G">LeapFrog Learn &#038; Groove™ Musical Table</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B002PHLU4G" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
We originally got this toy when our daughter was showing signs of wanting to stand on her own.  The toy itself is stuffed with several auditory and visual feedback that really grabs her attention.<br />
<a href="http://www.amazon.com/gp/product/B002PHLU4G?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B002PHLU4G"><img src="http://blog.unthinkmedia.com/wp-content/uploads/51NJ3M2DARL._AA300_.jpg" alt="" title="51NJ3M2DARL._AA300_" width="300" height="300" class="alignleft size-full wp-image-591" /></a></p>
<p>Inputs</p>
<ul>
<li>Push Buttons: Typically buttons on toys are visually obvious, however Fisher Price decided to create an exploratory interaction by spreading out four button throughout the plush doll.  Three of the buttons are hidden under the fabric, on the toe, chest, and back, and the final button switch is closed by squeezing his nose.</li>
<li>Toggling Buttons: From watching my daughter play with this section of the table, I noticed that the design decision was probably based around learning not only shapes, but also cause and effect.  When she presses one, the previously pressed button switch pops up to an open state.</li>
<li>Flipping : This might be one of my daughter favorite interactions.  It may be partly due to the fact that we read a lot of books to her, or it might just be an intrinsic curiosity that makes her want to flip things over.  Feedback is dispatched when the child flips the pages of the book on the center of the toy, and also when they open the small compartment on one of the sides.  I would imagine that the switch is hidden on the hinge of the book. Each page has individual hinges that are associate with it. Once the page is flipped and crosses the angular threshold an embedded audio file is dispatched, along with some dancing LEDs. </li>
<li>Slider: The slider, is a &#8220;slider&#8221; in the physical interaction sense of the word. However the slider does not send an analog signal, or at least is doesn&#8217;t technically need too.  I believe that the reason for the design decision was mainly an educational one to create opportunity to exercise multiple sensory motor functions (sliding, twisting, pushing, flipping, etc.) </li>
</ul>
<p><br style="clear:both;" /></p>
<p><strong><a href="http://www.amazon.com/gp/product/B001W35I8I?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001W35I8I">LeapFrog My Pal Violet</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B001W35I8I" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
This product is actually one of my favorites. In the exterior it seems like a pretty straight forward digitally enhanced plush toy, but it add another layer of interaction for the parent, which evolves connecting the toy to the computer via USB and downloading audio files onto the toy. There is also some slight visual feedback from the LED that is housed in the plastic bone around the toy&#8217;s neck.<br />
<a href="http://www.amazon.com/gp/product/B001W35I8I?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001W35I8I"><img src="http://blog.unthinkmedia.com/wp-content/uploads/51Ff8bs7pwL._SL500_AA300_.jpg" alt="" title="51Ff8bs7pwL._SL500_AA300_" width="300" height="300" class="alignleft size-full wp-image-592" /></a></p>
<p>Inputs</p>
<p>Push Buttons: There are 4 normally open push buttons, each living on one of the plush dog&#8217;s paws. All the buttons, have iconic representations of the type of audio that it will dispatch once the switch is closed: Music, Action, Lullaby , and Power Off. </p>
<p>Parental Interaction<br />
Keyboard/Mouse: The toy comes with a desktop application that syncs with the toy via USB. The parent could then select which audio files to have the available to the toy. They are also able to personalizing some the interaction, by selecting from a list of names.<br />
<br style="clear:both;" /></p>
<p><strong><a href="http://www.amazon.com/gp/product/B000NRX5XE?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000NRX5XE">LeapFrog Spin and Sing Alphabet Zoo</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B000NRX5XE" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
This was probably the first toy that my daughter mastered at a couple months old. She almost looked like a boxer spinning the all the letters round and round, and enjoy the audio that is dispatched on the toys active state. Once the action stops, and the spinning section comes to a stop, the audio dispatches which animal or letter is in between the arrows, sort of like the large wheel from Wheel of fortune.</p>
<p><a href="http://www.amazon.com/gp/product/B000NRX5XE?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000NRX5XE"><img src="http://blog.unthinkmedia.com/wp-content/uploads/pTRU1-3387830reg.jpg" alt="" title="pTRU1-3387830reg" width="220" height="220" class="alignleft size-full wp-image-588" /></a></p>
<p>Inputs</p>
<p>Without gutting this toy (my wife would kill me) I&#8217;m not too sure how they made this work, however my best guess is:</p>
<p>Metal roller/ball bearing &#038; Metal Plate contact:  each of the 25 selections have individual plates that are connected to some sort of Shift register or multiplexer. As the the spinning action occurs the fixed conductive roller stays in contact with each of the plates that passes by. Once an individual contact is closed for about a second, the spin cycle is assumed to have finished, and the appropriate audio file is dispatched. Not sure if this is accurate since this may add friction. I can&#8217;t be sure unless i open it up.<br />
<br style="clear:both;" /></p>
<p>Here is a video of my daughter playing with this toy:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/erkl1VqG114&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/erkl1VqG114&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong><a href="http://www.amazon.com/gp/product/B000ETREN8?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000ETREN8">LeapFrog Learn &#038; Groove Counting Maracas</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B000ETREN8" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
These are bionic baby rattles/maraca that sense when they are being shaken. Once they are shaken an array of lights and melodies start to play. These are lots of fun, and has an added affordance of making adults act like complete fools.</p>
<p><a href="http://www.amazon.com/gp/product/B000ETREN8?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000ETREN8"><img src="http://blog.unthinkmedia.com/wp-content/uploads/pTRU1-2878179reg.jpg" alt="" title="pTRU1-2878179reg" width="220" height="220" class="alignleft size-full wp-image-586" /></a><br />
Input</p>
<ul>
<li>Slide Switch: This is just a simple multi state switch to adjust various mode settings</li>
<li>Accelerometer or Tilt Switch: Not sure exactly how they are sensing movement, but typically you would use either a tilt switch, or accelerometer. I would put money on the tilt switch mainly for cost, and being that the accelerometer may be overkill.</li>
</ul>
<p><br style="clear:both;" /></p>
<p><strong><a href="http://www.amazon.com/gp/product/B000W3TD44?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000W3TD44">Fisher-Price Go Baby Go! Crawl-Along Musical Ball</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B000W3TD44" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
We bought this toy when the baby was in the brink of starting of crawling.  The interaction involves rolling the ball and watch the illusion of the monkey keeping it&#8217;s balance, while letting out some humorous squeals.<br />
<a href="http://www.amazon.com/gp/product/B000W3TD44?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B000W3TD44"><img src="http://blog.unthinkmedia.com/wp-content/uploads/pG01-4243725reg.jpg" alt="" title="pG01-4243725reg" width="220" height="220" class="alignleft size-full wp-image-595" /></a><br />
Input<br />
The only input for this toy is sensing that the ball is in movement. Since the ball roll only in one direction, I would imagine a spinning tilt switch is all that was needed to sense when the ball was in motion.<br />
<br style="clear:both;" /></p>
<p><strong><a href="http://www.amazon.com/gp/product/B001U5R200?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001U5R200">LeapFrog Tag Junior Book Pal &#8211; Purple</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=B001U5R200" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
</strong><br />
One of my friends bought this toy for my daughter, which is a bit advanced for her, however extremely impressive.  This toy serves a scaffold for children that are learning to read. By simply touching the pen on the area of the word, it dispatches an audio files that speaks the word that they child selected.<br />
<a href="http://www.amazon.com/gp/product/B001U5R200?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=B001U5R200"><img src="http://blog.unthinkmedia.com/wp-content/uploads/pTRU1-5751447reg.jpg" alt="" title="pTRU1-5751447reg" width="220" height="220" class="alignleft size-full wp-image-615" /></a><br />
Input</p>
<p>It is totally beyond me how this technology works, but I will post up a video of me trying to guess. No idea if will actually be right, and unfortunately I need to wait till my daughter could read before I could take it apart, so a guess will do for now.<br />
<br style="clear:both;" /><br />
My guess on how the LeapFrog Tag Junior works:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/9XvYnvjyzps&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9XvYnvjyzps&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><em><strong>Update</strong>:  So it turns out I was correct&#8230;woohoo!  I did a few searches and ran into the LeapFrog FlyPaper Pen. I didn&#8217;t event know LeapFrog made this. Anyhow, I downloaded the manual and this is what it says under &#8220;How it works&#8221;. (would have been a lot easier if they added that section in the Tag manual). </p>
<blockquote><p>The FLY Fusion Pentop Computer has a built-in camera next to the writing tip. When you write, the camera sees tiny dots on the FLY™ Paper, which are printed with reflective ink in a very subtle pattern. The camera takes a series of fast snapshots of the dots, reads the pattern, and finds the action assigned to those dots.</p></blockquote>
<p>I think it is safe to assume that they leveraged the same technology.</p>
<p>I also found another guy who made a video about the same exact topic, and had the same answer. <a href="http://www.youtube.com/watch?v=A6yKZ1wjUgg">http://www.youtube.com/watch?v=A6yKZ1wjUgg</a></em></p>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/03/27/sensing-childs-play-examining-7-toys-from-the-toybox/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=579&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/03/27/sensing-childs-play-examining-7-toys-from-the-toybox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Initial Test of my Expandable/Interchangeable Circuit</title>
		<link>http://blog.unthinkmedia.com/2010/03/20/initial-test-of-my-expandable-circuit/</link>
		<comments>http://blog.unthinkmedia.com/2010/03/20/initial-test-of-my-expandable-circuit/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 06:05:10 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[programing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[digital manipulative]]></category>
		<category><![CDATA[EEPROM]]></category>
		<category><![CDATA[manipulative]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=562</guid>
		<description><![CDATA[So what do i mean by expandable? Basically the idea is that I would like the cheapest possible way to be able to create a circuit that I could chain sub circuits too (those are the 2 sub circuits in the video). After lots of trial and error, I was able to put on my [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://static.sparkfun.com/images/products/EEPROM_i_ma.jpg" class="alignright" width="188" height="188" />So what do i mean by expandable? Basically the idea is that I would like the cheapest possible way to be able to create a circuit that I could chain sub circuits too (those are the 2 sub circuits in the video).  After lots of trial and error, I was able to put on my crafty hat to make these darn electrons work the way I wanted them too.</p>
<p>In the accompanying video, I give a quick run through of how the circuit works.  Essentially, the main goal that I was able to achieve was that I would be able to clone one the inner circuits and add it right in the middle. All I would need to do is connect them to the 2 digital pins, 2 analog pins, one ground, and one 5V series, and it should work without any additional rewiring (although the idea is to make the sub circuits slightly different in their interaction, yet the same in their communication), asides from programing the EEPROM (<a href="http://www.sparkfun.com/commerce/product_info.php?products_id=525">I used the 24LC256 from SparkFun for $1.95</a>) to contain a unique identifier.  The secret to success&#8230;diodes..lots of them.</p>
<p>I based my code on a <a href="http://www.arduino.cc/playground/Code/I2CEEPROM">great snippet of code</a> to help me get the I2C communication working on my EEPROMs. I also checked out a <a href="http://www.ghettohax.com/2009/02/i2c-eeprom-for-arduino.html">helpful tutorial </a>which also helped me out substantially.</p>
<p>One quick tip: Keep in mind that Arduino has an EEPROM mounted on the chip.  I intially made the silly mistake of using the <a href="http://arduino.cc/en/Tutorial/HomePage">EEPROM code that is found on the Arduino tutorial page</a>. This code was reading and writing data on my Arduino&#8217;s board mounted EEPROM, which i quickly realized once I realized that the unique data I was writing on each external EEPROM chip did not seem to be working properly.</p>
<p>So why go through all this extra effort?<span id="more-562"></span> Basically there are two reasons.</p>
<p>1) allowing a person to customize and interchange their toy gives them an added sense of ownership, and taps into an emotional type of attachment.<br />
2) it is pretty easy to come up with a ways of taking the ideas behind this circuit, and give very young children the ability to construct abstract concepts such as flow. This in turn makes this simple interaction material a digital manipulative with extraordinary educational benefit.</p>
<p>One of my points of inspiration was <a href="http://llk.media.mit.edu/projects.php?id=136">MIT&#8217;s Mitchel Resnic&#8217;s Programmable Beads </a>, and other work with digital manipulative that I&#8217;ve spoken about <a href="http://blog.unthinkmedia.com/?p=228">on other posts</a>.</p>
<p>Onto phase 2&#8230;</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/82UoO6F9wdM&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/82UoO6F9wdM&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>Here is a video of Mitch Resnick speaking about his Lifelong Kindergarten group at the MIT Media Lab</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/pyvpz2aRH4o&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/pyvpz2aRH4o&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/03/20/initial-test-of-my-expandable-circuit/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=562&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/03/20/initial-test-of-my-expandable-circuit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Update Twitter Status w/ Arduino &amp; Processing</title>
		<link>http://blog.unthinkmedia.com/2010/02/26/update-twitter-status-w-arduino-processing/</link>
		<comments>http://blog.unthinkmedia.com/2010/02/26/update-twitter-status-w-arduino-processing/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 15:55:30 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[programing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[physical computing]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=520</guid>
		<description><![CDATA[The next phase of my project was to send the serial communication from my Arduino, over to Processing, which then would formulate a status update based on the button you pressed and send it over to Twitter. I&#8217;ve worked with several Twitter API&#8217;s in the past, so I decided to go with Twitter4J, the &#8220;J&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>The next phase of my project was to send the serial communication from my Arduino, over to Processing, which then would formulate a status update based on the button you pressed and send it over to Twitter.  I&#8217;ve worked with several Twitter API&#8217;s in the past, so I decided to go with <a href="http://twitter4j.org/en/index.html">Twitter4J</a>, the &#8220;J&#8221; in this case stands for Java, which works perfectly with Processing.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/BY9ZiiQxXWU&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BY9ZiiQxXWU&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Bellow is an updated version of my previous Arduino coding. I plan on switching the status updating to the Processing side, instead of the Arduino side. If this where to be a real product, it would be easier to download a software update, then to have to reprogram the toy itself.  I will add that to my todo list, once i get all the major <span id="more-520"></span>functionality working.</p>

<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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// BUTTONS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonGreen <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonRed <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonYellow <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//LEDS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledGreen <span style="color: #339933;">=</span>  <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledRed <span style="color: #339933;">=</span>  <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledYellow <span style="color: #339933;">=</span>  <span style="color: #0000dd;">4</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//STORE BUTTON STATES</span>
<span style="color: #993333;">int</span> greenState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> redState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> yellowState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">int</span> lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Keep track of the activeLED</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>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  pinMode<span style="color: #009900;">&#40;</span>buttonRed<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  pinMode<span style="color: #009900;">&#40;</span>buttonYellow<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<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: #666666; font-style: italic;">// CHECK BTN STATES</span>
  greenState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  redState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonRed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  yellowState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonYellow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/**********
   *  Each of the following conditionals only sends one Serial message
   *  per button press
   **********/</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//GREEN</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>greenState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">//check if last active LED was not Green </span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledGreen<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//print the respective message for each button only once per mouse press. End message transmission with '10' which is linefeed.</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;green&quot;</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><span style="color: #0000dd;">10</span><span style="color: #339933;">,</span> BYTE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    <span style="color: #666666; font-style: italic;">//store green as last active press</span>
    lastActiveLED <span style="color: #339933;">=</span> ledGreen<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//clear out last active so you could reclick it</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledGreen<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</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;">//RED</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>redState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledRed<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;red&quot;</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><span style="color: #0000dd;">10</span><span style="color: #339933;">,</span> BYTE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    lastActiveLED <span style="color: #339933;">=</span> ledRed<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledRed<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> LOW<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;">//YELLOW</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>yellowState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledYellow<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;yellow&quot;</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><span style="color: #0000dd;">10</span><span style="color: #339933;">,</span> BYTE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    lastActiveLED <span style="color: #339933;">=</span> ledYellow<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledYellow<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now that we are sending message, we need to listen.  I decided to go with Processing since I&#8217;ve always been curious about it, and it is about as seamless of a coding experience as you could possibly get with Arduino.</p>
<p>In order to get the Twitter4J Java Library working you first needed to drag the .jar file directly onto your Processing sketch, and that is pretty much it. Bellow is the Processing code that simply listens for a Serial Event (Arduino button press), and then sends the status message over to Twitter.</p>
<p>Being a total N00bie to Processing, one additional tip that confused me was Fonts. Processing doesn&#8217;t allow True Type Fonts, so if you want to add text to your project you need to go to:</p>
<p>Tools > Create Fonts&#8230;  </p>
<p>and then select the font you would like to use. The Processing IDE then converts the font to a .vlw file. You could find the file in a folder named &#8216;data&#8217; that gets created within your projected folder.</p>

<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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*************
*    based on:  http://processing.org/reference/libraries/serial/serialEvent_.html
*************/</span>
&nbsp;
import processing.<span style="color: #202020;">serial</span>.<span style="color: #339933;">*;</span> 
&nbsp;
Serial myPort<span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// The serial port </span>
PFont myFont<span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">// The display font </span>
String inString<span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// Input string from serial port </span>
<span style="color: #993333;">int</span> lf <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// ASCII linefeed </span>
&nbsp;
Twitter twitter<span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// Twitter</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Going to get oAuth working instead of this, but this will do for now</span>
String username <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;YOUR-TWITTER-USERNAME&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// you Twitter Username Here</span>
String password <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;YOUR-TWITTER-PASSWORD&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// your Twitter Password Here</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> 
  size<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">400</span><span style="color: #339933;">,</span><span style="color: #0000dd;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  twitter <span style="color: #339933;">=</span> new Twitter<span style="color: #009900;">&#40;</span>username<span style="color: #339933;">,</span>password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  myFont <span style="color: #339933;">=</span> loadFont<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;AppleGothic-48.vlw&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  textFont<span style="color: #009900;">&#40;</span>myFont<span style="color: #339933;">,</span> <span style="color: #0000dd;">18</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  println<span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  myPort <span style="color: #339933;">=</span> new Serial<span style="color: #009900;">&#40;</span>this<span style="color: #339933;">,</span> Serial.<span style="color: #202020;">list</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  myPort.<span style="color: #202020;">bufferUntil</span><span style="color: #009900;">&#40;</span>lf<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//wiat for line feed to specify end of serial buffer</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #993333;">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><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  text<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;color selected: &quot;</span> <span style="color: #339933;">+</span> inString<span style="color: #339933;">,</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">,</span><span style="color: #0000dd;">50</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> serialEvent<span style="color: #009900;">&#40;</span>Serial p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  inString <span style="color: #339933;">=</span> p.<span style="color: #202020;">readString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//read serial string</span>
  <span style="color: #666666; font-style: italic;">//For some reason this only wanted to work in a try catch</span>
  try
  <span style="color: #009900;">&#123;</span>
    Status status1 <span style="color: #339933;">=</span> twitter.<span style="color: #202020;">updateStatus</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Arduino's favorite color is &quot;</span><span style="color: #339933;">+</span>inString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//update twitter status</span>
  <span style="color: #009900;">&#125;</span>
  catch<span style="color: #009900;">&#40;</span> TwitterException e<span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
    println<span style="color: #009900;">&#40;</span>e.<span style="color: #202020;">getStatusCode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/02/26/update-twitter-status-w-arduino-processing/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=520&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/02/26/update-twitter-status-w-arduino-processing/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Arduino: Print a Single Serial Message per Button Press</title>
		<link>http://blog.unthinkmedia.com/2010/02/24/arduino-print-a-single-serial-message-per-button-press/</link>
		<comments>http://blog.unthinkmedia.com/2010/02/24/arduino-print-a-single-serial-message-per-button-press/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 06:16:37 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[programing]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=512</guid>
		<description><![CDATA[So I&#8217;ve been working on a new project and have run into a bit of an issue. I plan to send a serial message over to Processing, however it very important that I don&#8217;t send multiple values stating the same button press. Since Arduino is in a constant loop state, when i press a button [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been working on a new project and have run into a bit of an issue.  I plan to send a serial message over to Processing, however it very important that I don&#8217;t send multiple values stating the same button press.  Since Arduino is in a constant loop state, when i press a button using something like:<br />
<span id="more-512"></span></p>

<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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// BUTTONS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonGreen <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//LEDS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledGreen <span style="color: #339933;">=</span>  <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//STORE BUTTON STATES</span>
<span style="color: #993333;">int</span> greenState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
&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>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #339933;">,</span> INPUT<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: #666666; font-style: italic;">// CHECK BTN STATES</span>
  greenState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//GREEN</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>greenState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> DEC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>When i check my serial monitor I receive something like:<br />
22222222222222222222222222&#8230;..</p>
<p>That won&#8217;t work, since I plan for each of the Serial events to make an API call to Twitter. This activity would wipe out my allotted request in a matter of a couple of clicks, and probably would result in getting my account suspended due to unusual activity. So bellow is a quick fix which store individual button clicks, and prints out the Serial output once. I also decided against using any delays, since that may have potentially ended up in ignoring a button press.</p>

<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
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// BUTTONS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonGreen <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonRed <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> buttonYellow <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//LEDS</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledGreen <span style="color: #339933;">=</span>  <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledRed <span style="color: #339933;">=</span>  <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
<span style="color: #993333;">const</span> <span style="color: #993333;">int</span> ledYellow <span style="color: #339933;">=</span>  <span style="color: #0000dd;">4</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//STORE BUTTON STATES</span>
<span style="color: #993333;">int</span> greenState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> redState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> yellowState <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">int</span> lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Keep track of the activeLED</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>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  pinMode<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  pinMode<span style="color: #009900;">&#40;</span>buttonRed<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  pinMode<span style="color: #009900;">&#40;</span>buttonYellow<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<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: #666666; font-style: italic;">// CHECK BTN STATES</span>
  greenState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonGreen<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  redState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonRed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  yellowState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>buttonYellow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/**********
   *  Each of the following conditionals only sends one Serial message
   *  per button press
   **********/</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">//GREEN</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>greenState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">//check if last active LED was not Green </span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledGreen<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//print Green since it is a new press</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> DEC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    <span style="color: #666666; font-style: italic;">//store green as last active press</span>
    lastActiveLED <span style="color: #339933;">=</span> ledGreen<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//clear out last active so you could reclick it</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledGreen<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> LOW<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;">//RED</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>redState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledRed<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> DEC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    lastActiveLED <span style="color: #339933;">=</span> ledRed<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledRed<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> LOW<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;">//YELLOW</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>yellowState <span style="color: #339933;">==</span> HIGH<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">!=</span> ledYellow<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> DEC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>   
    lastActiveLED <span style="color: #339933;">=</span> ledYellow<span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">100</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>lastActiveLED <span style="color: #339933;">==</span> ledYellow<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      lastActiveLED <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>If anyone knows of any other methods of doing this, let me know!
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/02/24/arduino-print-a-single-serial-message-per-button-press/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=512&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/02/24/arduino-print-a-single-serial-message-per-button-press/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIY Simon with Arduino w/ Source and Diagram</title>
		<link>http://blog.unthinkmedia.com/2010/02/09/diy-simon-with-arduino-w-source-and-diagram/</link>
		<comments>http://blog.unthinkmedia.com/2010/02/09/diy-simon-with-arduino-w-source-and-diagram/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 06:03:14 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=475</guid>
		<description><![CDATA[So i finally had time to tinker around with this Simon Sez project again. Turns out there wasn&#8217;t an issue after all with my circuits, it was an issue in my code. I also did some house keeping on the code, and created a nice little diagram using Fritzing, an awesome app that was recommend [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.unthinkmedia.com/wp-content/uploads/Simon_bb.jpg"><img src="http://blog.unthinkmedia.com/wp-content/uploads/Simon_bb-300x121.jpg" alt="" title="Simon_bb" width="300" height="121" class="alignright size-medium wp-image-476" /></a><br />
So i finally had time to tinker around with this Simon Sez project again. Turns out there wasn&#8217;t an issue after all with my circuits, it was an issue in my code.  I also did some house keeping on the code, and created a nice little diagram using <a href="http://fritzing.org/">Fritzing</a>, an awesome app that was recommend to our class <span id="more-475"></span> by <a href="http://www.tigoe.net/">Tom Igoe</a>.</p>
<p>I tried to keep both programming and circuitry as slim as I could, and I think that worked out pretty well.  Not sure if i will add anything else to this, but if anyone has any ideas, asides from my <a href="http://twitter.com/orian/status/8828061476">coworker&#8217;s recent tweet</a>, then Iet me know.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/9IbpiVJKoPU&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9IbpiVJKoPU&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>This source code:</p>

<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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"> <span style="color: #808080; font-style: italic;">/*
   Simon Sez
&nbsp;
&nbsp;
  created Feb 10 2010
  by Alex Britez
&nbsp;
  http://blog.unthinkmedia.com/?p=475
&nbsp;
  */</span>
&nbsp;
<span style="color: #339933;">#include &lt;Tone.h&gt;</span>
&nbsp;
Tone audioFeedback<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//DEFINE MOTOR</span>
<span style="color: #993333;">int</span> transistorPin <span style="color: #339933;">=</span> <span style="color: #0000dd;">12</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #993333;">int</span> speakerPin <span style="color: #339933;">=</span> <span style="color: #0000dd;">6</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//DEFINE LEDS</span>
<span style="color: #993333;">int</span> ledWhite <span style="color: #339933;">=</span> <span style="color: #0000dd;">11</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> ledGreen <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> ledRed <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> ledYellow <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">char</span> leds<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  ledWhite<span style="color: #339933;">,</span>ledGreen<span style="color: #339933;">,</span>ledRed<span style="color: #339933;">,</span>ledYellow<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//DEFINE SWITCHES </span>
<span style="color: #993333;">int</span> switchWhite <span style="color: #339933;">=</span> <span style="color: #0000dd;">5</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> switchGreen <span style="color: #339933;">=</span> <span style="color: #0000dd;">4</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> switchRed <span style="color: #339933;">=</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> switchYellow <span style="color: #339933;">=</span> <span style="color: #0000dd;">2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//AUDIO</span>
<span style="color: #993333;">int</span> notes<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  NOTE_D4<span style="color: #339933;">,</span>NOTE_E4<span style="color: #339933;">,</span>NOTE_F4<span style="color: #339933;">,</span>NOTE_G4<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//this plays if you win</span>
<span style="color: #993333;">int</span> winNotes<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  NOTE_D4<span style="color: #339933;">,</span> NOTE_E4<span style="color: #339933;">,</span>NOTE_C4<span style="color: #339933;">,</span>NOTE_C3<span style="color: #339933;">,</span>NOTE_G3 <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> durations<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #0000dd;">500</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">500</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">500</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">500</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1000</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #993333;">int</span> playbackCount <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//autoplay selection count</span>
<span style="color: #993333;">int</span> selectionCount<span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//player selection count</span>
&nbsp;
<span style="color: #993333;">int</span> currentLevel <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//current game level</span>
&nbsp;
boolean watchMode <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Simon's turn, false means it is the players turn </span>
&nbsp;
<span style="color: #666666; font-style: italic;">//store which switch is currently active?</span>
<span style="color: #993333;">int</span> pressAry<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Storing the squence that gets randomly generated, Num in brackets states how long sequence is [#]</span>
<span style="color: #993333;">int</span> sequenceAry<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">7</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> sequenceAryLegnth <span style="color: #339933;">=</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>sequenceAry<span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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>
  pinMode<span style="color: #009900;">&#40;</span>ledWhite<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledGreen<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>ledRed<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>     
  pinMode<span style="color: #009900;">&#40;</span>ledYellow<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>switchWhite<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>switchGreen<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>switchRed<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>     
  pinMode<span style="color: #009900;">&#40;</span>switchYellow<span style="color: #339933;">,</span> INPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>transistorPin<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  randomSeed<span style="color: #009900;">&#40;</span>analogRead<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//Add this so sequence is truely random</span>
  audioFeedback.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span>speakerPin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  createRandomSequence<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: #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: #808080; font-style: italic;">/************
   *  Check to see if simon/player mode
   *************/</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>watchMode <span style="color: #339933;">==</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #808080; font-style: italic;">/************
   *  SIMON SEZ: leds automatically blink in random sequence
   *************/</span>
    <span style="color: #666666; font-style: italic;">//have you won?</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>playbackCount <span style="color: #339933;">&lt;=</span> sequenceAryLegnth<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//has simon finshed showing current sequence?</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>playbackCount <span style="color: #339933;">&lt;</span> currentLevel<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//Blink proper LED from leds array</span>
        <span style="color: #993333;">int</span> activeLED_index <span style="color: #339933;">=</span> sequenceAry<span style="color: #009900;">&#91;</span>playbackCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        digitalWrite<span style="color: #009900;">&#40;</span>leds<span style="color: #009900;">&#91;</span>activeLED_index<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//Play corrisponding note</span>
        audioFeedback.<span style="color: #202020;">play</span><span style="color: #009900;">&#40;</span>notes<span style="color: #009900;">&#91;</span>activeLED_index<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        digitalWrite<span style="color: #009900;">&#40;</span>leds<span style="color: #009900;">&#91;</span>activeLED_index<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        audioFeedback.<span style="color: #202020;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        playbackCount<span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">//simon is done, now it is players turn</span>
        watchMode <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
       <span style="color: #808080; font-style: italic;">/************
       *  PLAYER WINS!
       *************/</span>
      playerWins<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//Read States of all Switches</span>
    <span style="color: #993333;">int</span> whiteState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>switchWhite<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> greenState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>switchGreen<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> redState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>switchRed<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #993333;">int</span> yellowState <span style="color: #339933;">=</span> digitalRead<span style="color: #009900;">&#40;</span>switchYellow<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #993333;">int</span> statesAry<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
      whiteState<span style="color: #339933;">,</span>greenState<span style="color: #339933;">,</span>redState<span style="color: #339933;">,</span>yellowState<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">//loop across all 4 switch states</span>
    <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> x<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> x<span style="color: #339933;">&lt;</span><span style="color: #0000dd;">4</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: #993333;">int</span> switchState <span style="color: #339933;">=</span> statesAry<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>switchState <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        audioFeedback.<span style="color: #202020;">play</span><span style="color: #009900;">&#40;</span>notes<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        digitalWrite<span style="color: #009900;">&#40;</span>leds<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        audioFeedback.<span style="color: #202020;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        digitalWrite<span style="color: #009900;">&#40;</span>leds<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>pressAry<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>sequenceAry<span style="color: #009900;">&#91;</span>selectionCount<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span>x<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            selectionCount<span style="color: #339933;">++;</span>
            pressAry<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
          <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
            resetGame<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: #009900;">&#125;</span>
&nbsp;
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
        pressAry<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// turn LED off:</span>
        digitalWrite<span style="color: #009900;">&#40;</span>leds<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> LOW<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;">//Check to see if we could incrament level</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>selectionCount <span style="color: #339933;">==</span> currentLevel<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        advanceLevel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">void</span> createRandomSequence<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> x<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> x<span style="color: #339933;">&lt;</span>sequenceAryLegnth<span style="color: #339933;">;</span> x<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      sequenceAry<span style="color: #009900;">&#91;</span>x<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> random<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************
 *  Play winning melody
 *************/</span>
<span style="color: #993333;">void</span> playerWins<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> thisNote <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> thisNote <span style="color: #339933;">&lt;</span> <span style="color: #0000dd;">5</span><span style="color: #339933;">;</span> thisNote <span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// play the next note:</span>
    audioFeedback.<span style="color: #202020;">play</span><span style="color: #009900;">&#40;</span>winNotes<span style="color: #009900;">&#91;</span>thisNote<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// hold the note:</span>
    delay<span style="color: #009900;">&#40;</span>durations<span style="color: #009900;">&#91;</span>thisNote<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// stop for the next note:</span>
    audioFeedback.<span style="color: #202020;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">// hold before repeating:</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************
 *  Incrament player one level
 *************/</span>
<span style="color: #993333;">void</span> advanceLevel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  resetValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  currentLevel<span style="color: #339933;">++;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #808080; font-style: italic;">/************
 *  Player pressed wrong button
 *************/</span>
<span style="color: #993333;">void</span> resetGame<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">//DISPATCH HAPTIC FEEDBACK </span>
  digitalWrite<span style="color: #009900;">&#40;</span>transistorPin<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>transistorPin<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  resetValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  currentLevel <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/************
 *  Reset all values so simon knows to start from the first LED in the sequenceAry
 *************/</span>
<span style="color: #993333;">void</span> resetValues<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  selectionCount <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  playbackCount <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  watchMode <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/02/09/diy-simon-with-arduino-w-source-and-diagram/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=475&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/02/09/diy-simon-with-arduino-w-source-and-diagram/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIY Simon with Arduino: Take 1</title>
		<link>http://blog.unthinkmedia.com/2010/02/07/diy-simon-with-arduino-take-1/</link>
		<comments>http://blog.unthinkmedia.com/2010/02/07/diy-simon-with-arduino-take-1/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 03:49:57 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[Physical Computing]]></category>
		<category><![CDATA[programing]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=462</guid>
		<description><![CDATA[This past week I was trying to figure out what i could work on for my Physical Computing class. My professor mentioned, Simon, so why not take on the challenge. Simon was one of my favorite game, I even have it on my iPhone. For those that may not remember the Simon game check out [...]]]></description>
			<content:encoded><![CDATA[<p>This past week I was trying to figure out what i could work on for my Physical Computing class.  My professor mentioned, Simon, so why not take on the challenge.  Simon was one of my favorite game, I even have it on my iPhone.  For those that may not remember the Simon game check out this commercial.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/KVzZVYtt64I&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/KVzZVYtt64I&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Anyhow, armed with some basic knowledge of electronics, and some programming knowledge, why not!  Bellow is my stab at Simon<span id="more-462"></span>, I even added some haptic feedback just because.  The audio is a bit low because it was 1am and I didn&#8217;t want to wake up my wife and daughter, but you get the idea.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/9IbpiVJKoPU&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/9IbpiVJKoPU&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Before I post up the code, I need to clean it up a little bit and get a bit more acquainted with C. The programing language that Ardiuno uses is pretty bare bones, so a lot of common functions that i have taken for granted don&#8217;t exist, go figure. Not a big deal, it will just take some research and tinkering to figure it out.</p>
<p>Another issue i had was regarding resistor setup, an 8 ohm speaker, and it&#8217;s affect to what i believe is the audio pitch.  The sound that plays during Simon&#8217;s turn and the sound of the same note that play during the button press is slightly different. May need to bring out the multi-meter and see how many ohms are being passed through, in both scenarios. I am using the <a href="http://code.google.com/p/arduino-tone/">Arduino Tone Library</a>. I&#8217;ll add my findings in my next post once i find some free time to get my debugging hat on. Other then that, my first real project went pretty smoothly.</p>
<p>As I mentioned, once I iron out these small bugs, I will post all the source and wiring, then take it apart and move onto my next project.  Homework has never been so much fun&#8230;ha!
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/02/07/diy-simon-with-arduino-take-1/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=462&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/02/07/diy-simon-with-arduino-take-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Examining an Everyday Physical Object</title>
		<link>http://blog.unthinkmedia.com/2010/01/21/examining-an-everyday-physical-object/</link>
		<comments>http://blog.unthinkmedia.com/2010/01/21/examining-an-everyday-physical-object/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 06:03:53 +0000</pubDate>
		<dc:creator>Alex Britez</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Physical Computing]]></category>

		<guid isPermaLink="false">http://blog.unthinkmedia.com/?p=383</guid>
		<description><![CDATA[At any given moment we are all surrounded by interactivity. From using the toaster, to setting up your DVR to record your favorite show, interaction with physical objects is part of our everyday life. Coming from a web centric outlook, I typically associate words such as interactivity to the multimedia and computer software, however interaction [...]]]></description>
			<content:encoded><![CDATA[<p>At any given moment we are all surrounded by interactivity. From using the toaster, to setting up your DVR to record your favorite show, interaction with physical objects is part of our everyday life.  Coming from a web centric outlook, I typically associate words such as interactivity to the multimedia and computer software, however interaction far exceeds the spatial confines of our monitors.</p>
<p>Breaking free of the monitor, and starting my voyage into the physical realms of physical computing, I decided to step-back and analyze some of the physical objects that I regularly interact with. It wasn&#8217;t long before I noticed the perfect subject. </p>
<p>The Metro Card Vending Machine is a common place for many New Yorkers. As a matter of fact, I thought it had a rather intuitive design, until this morning. They have incorporated a sexy touch screen design, with large buttons so clumsy fingers don&#8217;t press the wrong thing. In my opinion the interface is quite intuitive and rather pleasant experience, or as pleasant as refilling your Metro Card could possibly be. <span id="more-383"></span></p>
<p><img alt="" src="http://www.newyork-traveltips.com/pics/metrocard-vending-machine.jpg" title="Metro Card Vending Machine" class="alignleft" width="336" height="601" /></p>
<p>This morning, on the machine next to the one that i was using, a tourist proved me wrong.  It turns out that the touchscreen is just one of several interfaces on the vending machine, and although the tourist easily navigated the metro card touchscreen buying experience, she still needed to interact with other parts of the machine that obviously didn&#8217;t receive as much love.</p>
<p>As the tourist selected her card type, amount, and payment type everything seemed great. She then dipped her credit card into the credit card slot, entered in her pin or zip depending on payment type and BOOM!  The screen asked her to press &#8220;Enter&#8221;. Since I was there observing her interaction with the machine, I let her argue with the machine a little while to see how long it would take her to figure it out&#8230; At least a minute passed and she started getting visible upset, her friend yelled out from the other side of the turnstile, &#8220;Just forget it and go to the booth!&#8221; Finally, I stepped in before she became completely ballistic and let her know that the enter is actually on the credit card keypad labeled ENT over the pound sign (#).  She thanked me and went on her way.</p>
<p>At that moment the tourist may have felt stupid, but is she really stupid? Could the design be flawed?  Stepping back and examining the interface which i have now identified as the &#8220;entire machine&#8221;, and not just the sexy touch screen, a couple things stand out. The first thing I noticed was that there are two separate inputs, the multi-touch screen and credit card keypad. This inherently splits the users attention jumping back and forth from screen to keypad, possibly causing confusion on what they should be looking at next. Although, moving the keypad to a digital version on the touch screen may seem like a viable answer, this would causes an added level of confusion by interrupting the spatial congruity that the credit card slot and the keypad have. So what is the answer? In the book, <a href="http://www.amazon.com/gp/product/1886411840?ie=UTF8&#038;tag=unthinkmedia-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=1886411840">The Art of Interactive Design: A Euphonious and Illuminating Guide to Building Successful Software</a><img src="http://www.assoc-amazon.com/e/ir?t=unthinkmedia-20&#038;l=as2&#038;o=1&#038;a=1886411840" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, Chris Crawford describes interactivity as:</p>
<p><img src="http://blog.unthinkmedia.com/wp-content/uploads/photo.jpg" alt="" title="photo" width="225" height="300" class="alignright size-medium wp-image-415" /></p>
<blockquote><p>interaction: a cyclic process in which two actors alternately listen, think, and speak.</p></blockquote>
<p>As the tourist was interacting with the Metro Card vending machine she was essentially communicating with the physical object. </p>
<blockquote><p>&#8220;Please enter your zipcode and press Enter&#8221; </p></blockquote>
<p>Obviously, the tourist can&#8217;t speak to the machine vocally, but she could communicate her selection through the buttons that are presented. Since the tourist could not find the Enter key she essentially was stripped of the ability to communicate, placing a muzzle on her interactive experience.  </p>
<p>A possible solutions that may have worked better by simply rewording the communication, may have looked like this:</p>
<blockquote><p>&#8220;Please enter your zipcode and press # on the keypad bellow&#8221;</p></blockquote>
<p>If you aren&#8217;t going to write out &#8216;ENTER&#8217; and simply use &#8216;ENT&#8217; on the pound key (#) that now serves a multiple function, then why bother having an enter key at all. Either add a physical key that serves the singular purpose of being &#8216;ENTER&#8217;, or make sure to properly communicate the design flaw to the user to avoid any confusion.</p>
<p>This brought up a couple great points that designers of physical computing should be aware of:</p>
<ul>
<li>
Don&#8217;t assume a task is obvious, although it may be obvious to you it may be confusing to someone else.</li>
<li>Sometimes you may be forced to use components that are not ideal, but meet the need in other ways such as budget, time and convenience.  Do your best to make sure that any confusing interaction is properly scaffolded to minimize error and avoid frustration</li>
</ul>
<div class='kouguu_fb_like_button'><iframe src="http://www.facebook.com/plugins/like.php?href=http://blog.unthinkmedia.com/2010/01/21/examining-an-everyday-physical-object/&#038;layout=standart&#038;show_faces=true&#038;width=450&#038;height=65&#038;action=like&#038;colorscheme=light&#038;" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:65px;"></iframe></div>
<img src="http://blog.unthinkmedia.com/?ak_action=api_record_view&id=383&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blog.unthinkmedia.com/2010/01/21/examining-an-everyday-physical-object/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

