<?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>Silveira Neto &#187; ULN2003A</title>
	<atom:link href="http://silveiraneto.net/tag/uln2003a/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description>the world is a pixel</description>
	<lastBuildDate>Sun, 08 Jan 2012 05:17:57 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>BumbaBot-1</title>
		<link>http://silveiraneto.net/2009/03/16/bumbabot-1/</link>
		<comments>http://silveiraneto.net/2009/03/16/bumbabot-1/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 03:43:42 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[boi bumbá]]></category>
		<category><![CDATA[bumba meu boi]]></category>
		<category><![CDATA[bumbabot-1]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[High-Current Darlington Transistor Arrays]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Hardware]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[roboitcs]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ULN2003A]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2384</guid>
		<description><![CDATA[ ]]></description>
			<content:encoded><![CDATA[<p>I got a simple motor from a broken domestic printer. It&#8217;s a <a title="Mitsumi product" href="http://www.mitsumi.co.jp/Catalog/compo/motor/m35sp9_e.html">Mitsumi m355P-9T stepping motor</a>. Any other common stepping motor should fits. You can find one in printers, multifunction machines, copy machines, FAX, and such.</p>
<p style="text-align: center;"><a title="bumbabot v01 by Silveira Neto, on Flickr" href="http://www.flickr.com/photos/silveiraneto/3358845802/"><img class="aligncenter" src="http://farm4.static.flickr.com/3460/3358845802_286e74ee01.jpg" alt="bumbabot v01" width="500" height="375" /></a></p>
<p>With a flexible cap of water bottle with a hole we make a connection between the motor axis and other objects.</p>
<p style="text-align: center;"><a title="bumbabot v01 by Silveira Neto, on Flickr" href="http://www.flickr.com/photos/silveiraneto/3358029549/"><img class="aligncenter" src="http://farm4.static.flickr.com/3571/3358029549_0b9680180a.jpg" alt="bumbabot v01" width="500" height="375" /></a></p>
<p style="text-align: center;"><a title="bumbabot v01 by Silveira Neto, on Flickr" href="http://www.flickr.com/photos/silveiraneto/3358031295/"><img class="aligncenter" src="http://farm4.static.flickr.com/3582/3358031295_fb8ed598cc.jpg" alt="bumbabot v01" width="500" height="375" /></a></p>
<p>With super glue I attached to the cap a little handcraft clay ox statue.</p>
<p style="text-align: center;"><a title="bumbabot v01 by Silveira Neto, on Flickr" href="http://www.flickr.com/photos/silveiraneto/3358032255/"><img class="aligncenter" src="http://farm4.static.flickr.com/3612/3358032255_3686d7e295.jpg" alt="bumbabot v01" width="500" height="375" /></a></p>
<p>It&#8217;s a representation from a Brazilian folkloric character <a title="Wikipedia, english" href="http://en.wikipedia.org/wiki/Bumba_Meu_Boi">Boi Bumbá</a>. In some traditional parties in Brazil, someone dress a structure-costume and dances in circular patterns interacting with the public.</p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/canoafurada/776513346/"><img class="size-full wp-image-2392 aligncenter" title="776513346_c31db6843b_m" src="http://silveiraneto.net/wp-content/uploads/2009/03/776513346_c31db6843b_m.jpg" alt="776513346_c31db6843b_m" width="198" height="240" /></a></p>
<p style="text-align: center;"><a href="http://www.flickr.com/photos/canoafurada/2246467684/"><img class="size-full wp-image-2393 aligncenter" title="2246467684_49164d3397_m" src="http://silveiraneto.net/wp-content/uploads/2009/03/2246467684_49164d3397_m.jpg" alt="2246467684_49164d3397_m" width="240" height="160" /></a><br />
<small>Photos by <a href="http://www.flickr.com/people/canoafurada/">Marcus Guimarães</a>.</small></p>
<p>Controlling a stepper motor is not difficult.  There&#8217;s a good documentation on how to that on the <a title="Arduino Docs" href="http://www.arduino.cc/en/Tutorial/StepperUnipolar">Arduino Stepper Motor Tutorial</a>. Basically it&#8217;s about sending a logical signal for each coil in a circular order (that is also called full step).</p>
<p style="text-align: center;"><img class="size-full wp-image-2403 aligncenter" title="full step" src="http://silveiraneto.net/wp-content/uploads/2009/03/animacompleto1.gif" alt="full step" width="97" height="97" /></p>
<p style="text-align: center;"><small>Animation from <a href="http://www.rogercom.com/pparalela/IntroMotorPasso.htm">rogercom.com</a>.</small></p>
<p style="text-align: center;"><img class="size-full wp-image-2400 aligncenter" title="stepper motor diagram" src="http://silveiraneto.net/wp-content/uploads/2009/03/stepper_motor_diagram.png" alt="stepper motor diagram" width="348" height="265" /></p>
<p>You&#8217;ll probably also use a driver chip ULN2003A or similar to give to the motor more current than your Arduino can provide and also for protecting it from a power comming back from the motor. It&#8217;s a very easy find this tiny chip on electronics or automotive  stores or also from broken printers where you probably found your stepped motor.</p>
<p style="text-align: center;"><img class="size-full wp-image-2404 aligncenter" title="Arduino Stepper Motor UNL2003A" src="http://silveiraneto.net/wp-content/uploads/2009/03/arduino_stepper_motor_uln2003a.jpg" alt="Arduino Stepper Motor UNL2003A" width="400" height="514" /></p>
<p>With a simple program you can already controlling your motor.</p>
<div class="wp_syntax">
<div class="code">
<pre class="c c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Simple stepped motor spin</span>
<span style="color: #666666; font-style: italic;">// by Silveira Neto, 2009, under GPLv3 license</span>
<span style="color: #666666; font-style: italic;">// http://silveiraneto.net/2009/03/16/bumbabot-1/</span>
<span style="color: #993333;">int</span> coil1 <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span>;
<span style="color: #993333;">int</span> coil2 <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span>;
<span style="color: #993333;">int</span> coil3 <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span>;
<span style="color: #993333;">int</span> coil4 <span style="color: #339933;">=</span> <span style="color: #0000dd;">11</span>;
<span style="color: #993333;">int</span> step <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;
<span style="color: #993333;">int</span> interval <span style="color: #339933;">=</span> <span style="color: #0000dd;">100</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>coil1<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil2<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil3<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil4<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</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>
  digitalWrite<span style="color: #009900;">&#40;</span>coil1<span style="color: #339933;">,</span> step<span style="color: #339933;">==</span><span style="color:#800080;">0</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil2<span style="color: #339933;">,</span> step<span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil3<span style="color: #339933;">,</span> step<span style="color: #339933;">==</span><span style="color: #0000dd;">2</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil4<span style="color: #339933;">,</span> step<span style="color: #339933;">==</span><span style="color: #0000dd;">3</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  delay<span style="color: #009900;">&#40;</span>interval<span style="color: #009900;">&#41;</span>;
  step <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>step<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span><span style="color:#800080;">4</span>;
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p style="text-align: center;"><object width="425" height="344" data="http://www.youtube.com/v/roq9z3tpEhI&amp;hl=pt-br&amp;fs=1" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/roq9z3tpEhI&amp;hl=pt-br&amp;fs=1" /><param name="allowfullscreen" value="true" /></object><br />
Writing a little bit more generally code we can create function to step forward and step backward.</p>
<p>My motor needs 48 steps to run a complete turn. So 360º/48 steps give us 7,5º per step. Arduino has a simple <a title="Arduino Reference" href="http://www.arduino.cc/en/Reference/Stepper">Stepper Motor Library</a> but it doesn&#8217;t worked with me and it&#8217;s also oriented to steps and I&#8217;d need something oriented to angles instead. So I wrote some routines to do that.</p>
<p>For this first version of BumbaBot I mapped angles with letters to easy the communication between the programs.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-2411" title="motor angle step control" src="http://silveiraneto.net/wp-content/uploads/2009/03/motor_angle_control_map.png" alt="motor angle step control" width="300" height="236" /></p>
<p>Notice that <strong>it&#8217;s not the final version and there&#8217;s still some bugs!</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="c c" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Stepped motor control by letters</span>
<span style="color: #666666; font-style: italic;">// by Silveira Neto, 2009, under GPLv3 license</span>
<span style="color: #666666; font-style: italic;">// http://silveiraneto.net/2009/03/16/bumbabot-1/</span>
&nbsp;
<span style="color: #993333;">int</span> coil1 <span style="color: #339933;">=</span> <span style="color: #0000dd;">8</span>;
<span style="color: #993333;">int</span> coil2 <span style="color: #339933;">=</span> <span style="color: #0000dd;">9</span>;
<span style="color: #993333;">int</span> coil3 <span style="color: #339933;">=</span> <span style="color: #0000dd;">10</span>;
<span style="color: #993333;">int</span> coil4 <span style="color: #339933;">=</span> <span style="color: #0000dd;">11</span>;
&nbsp;
<span style="color: #993333;">int</span> delayTime <span style="color: #339933;">=</span> <span style="color: #0000dd;">50</span>;
<span style="color: #993333;">int</span> steps <span style="color: #339933;">=</span> <span style="color: #0000dd;">48</span>;
<span style="color: #993333;">int</span> step_counter <span style="color: #339933;">=</span> <span style="color:#800080;">0</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>coil1<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil2<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil3<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span>;
  pinMode<span style="color: #009900;">&#40;</span>coil4<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</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: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// tells motor to move a certain angle</span>
<span style="color: #993333;">void</span> moveAngle<span style="color: #009900;">&#40;</span><span style="color: #993333;">float</span> angle<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> i;
  <span style="color: #993333;">int</span> howmanysteps <span style="color: #339933;">=</span> angle<span style="color: #339933;">/</span>stepAngle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>howmanysteps<span style="color: #339933;">&lt;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    howmanysteps <span style="color: #339933;">=</span> <span style="color: #339933;">-</span> howmanysteps;
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>angle<span style="color: #339933;">&gt;</span><span style="color:#800080;">0</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>i <span style="color: #339933;">=</span> <span style="color:#800080;">0</span>;i<span style="color: #339933;">&lt;</span>howmanysteps; i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      step<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">%</span><span style="color:#800080;">4</span><span style="color: #009900;">&#41;</span>;
      delay<span style="color: #009900;">&#40;</span>delayTime<span style="color: #009900;">&#41;</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: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color:#800080;">0</span>;i<span style="color: #339933;">&lt;</span>howmanysteps;i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      backstep<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">%</span><span style="color:#800080;">4</span><span style="color: #009900;">&#41;</span>;
      delay<span style="color: #009900;">&#40;</span>delayTime<span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// tells motor to move to a certain angle</span>
<span style="color: #993333;">void</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #993333;">float</span> angle<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  moveAngle<span style="color: #009900;">&#40;</span>angle<span style="color: #339933;">-</span>actualAngle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// actual stepper motor angle</span>
<span style="color: #993333;">float</span> actualAngle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> step_counter<span style="color: #339933;">*</span>stepAngle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// angle made by each step</span>
<span style="color: #993333;">float</span> stepAngle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color:#800080;">360.0</span><span style="color: #339933;">/</span>steps;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// backward step</span>
<span style="color: #993333;">void</span> backstep<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> coil<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>coil1<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil2<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil3<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil4<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  step_counter--;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// forward step</span>
<span style="color: #993333;">void</span> step<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> coil<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>coil1<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil2<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil3<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  digitalWrite<span style="color: #009900;">&#40;</span>coil4<span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>coil<span style="color: #339933;">==</span><span style="color: #0000dd;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">?</span>HIGH<span style="color: #339933;">:</span>LOW<span style="color: #009900;">&#41;</span>;
  step_counter++;
<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>
  byte val;
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    val <span style="color: #339933;">=</span> Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'A'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span>  <span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'B'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">45</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'C'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">90</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'D'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">135</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'E'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">180</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'F'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">225</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'G'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">270</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'H'</span><span style="color: #339933;">:</span> moveToAngle<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">315</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'I'</span><span style="color: #339933;">:</span> backstep<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>; backstep<span style="color: #009900;">&#40;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>; <span style="color: #000000; font-weight: bold;">break</span>;
      <span style="color: #b1b100;">case</span> <span style="color: #ff0000;">'J'</span><span style="color: #339933;">:</span> step<span style="color: #009900;">&#40;</span><span style="color:#800080;">0</span><span style="color: #009900;">&#41;</span>; step<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>;   <span style="color: #000000; font-weight: bold;">break</span>;
    <span style="color: #009900;">&#125;</span>
    Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>val<span style="color: #009900;">&#41;</span>;
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre>
</div>
</div>
<p>In another post I wrote <a title="Arduino and Java" href="http://silveiraneto.net/2009/03/01/arduino-and-java/">how create a Java program to talk with Arduino</a>. We&#8217;ll use this to send messages to Arduino to it moves. </p>
<p style="text-align: center;"><img src="http://silveiraneto.net/wp-content/uploads/2009/03/captura_de_tela-bumba01-netbeans-ide-65-500x283.png" alt="captura_de_tela-bumba01-netbeans-ide-65" title="captura_de_tela-bumba01-netbeans-ide-65" width="500" height="283" class="alignnone size-medium wp-image-2416" /></p>
<p>[put final video here]</p>
<p><strong>To be continued&#8230; </strong>:)</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/03/16/bumbabot-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

