<?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>O.Cantinho.da.Programação &#187; RobóticTank</title>
	<atom:link href="/tag/robotictank/feed/" rel="self" type="application/rss+xml" />
	<link>http://omundodaprogramacao.com</link>
	<description>O mundo da programação visto pelos olhos de um novato</description>
	<lastBuildDate>Mon, 07 May 2012 23:01:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Project RobóticTank &#8211; Arduino Keyboard Controler</title>
		<link>http://omundodaprogramacao.com/project-robotictank-arduino-keyboard-controler/</link>
		<comments>http://omundodaprogramacao.com/project-robotictank-arduino-keyboard-controler/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 12:00:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Electrónica]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Línguagens de Programação]]></category>
		<category><![CDATA[Programação]]></category>
		<category><![CDATA[Projectos]]></category>
		<category><![CDATA[Robótica]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[RobóticTank]]></category>

		<guid isPermaLink="false">http://omundodaprogramacao.com/?p=4504</guid>
		<description><![CDATA[Mais uma vez fiz uns pequenos progressos na área da robótica, mas propriamente no controlo do meu RobóticTank através do teclado do computador. Para fazer isto recorri ao seguinte código: int n; int motorPin1 = 5; int motorPin2 = 6; int motorPin3 = 10; int motorPin4 = 11; void setup() { Serial.begin(9600); pinMode(motorPin1, OUTPUT); pinMode(motorPin2, [...]]]></description>
			<content:encoded><![CDATA[<p>Mais uma vez fiz uns pequenos progressos na área da robótica, mas propriamente no controlo do meu RobóticTank através do teclado do computador.</p>
<p>Para fazer isto recorri ao seguinte código:</p>
<blockquote><p>int n;<br />
int motorPin1 = 5;<br />
int motorPin2 = 6;<br />
int motorPin3 = 10;<br />
int motorPin4 = 11;</p>
<p>void setup()<br />
{<br />
Serial.begin(9600);<br />
pinMode(motorPin1, OUTPUT);<br />
pinMode(motorPin2, OUTPUT);<br />
pinMode(motorPin3, OUTPUT);<br />
pinMode(motorPin4, OUTPUT);</p>
<p>}</p>
<p>void loop()<br />
{</p>
<p>if (Serial.available() &gt; 0)<br />
{<br />
n = Serial.read();</p>
<p>Serial.print(&#8220;Voce Digitou: &#8220;);<br />
Serial.println(n, BYTE);</p>
<p>if (n == 119)<br />
{<br />
//Avançar</p>
<p>digitalWrite(motorPin1, LOW);<br />
digitalWrite(motorPin2, HIGH);<br />
digitalWrite(motorPin3, HIGH);<br />
digitalWrite(motorPin4, LOW);<br />
}</p>
<p>if ( n == 115)<br />
{<br />
//Recuar</p>
<p>digitalWrite(motorPin1, HIGH);<br />
digitalWrite(motorPin2, LOW);<br />
digitalWrite(motorPin3, LOW);<br />
digitalWrite(motorPin4, HIGH);<br />
}</p>
<p>if ( n == 100)<br />
{<br />
//Direita<br />
digitalWrite(motorPin1, LOW);<br />
digitalWrite(motorPin2, HIGH);<br />
digitalWrite(motorPin3, LOW);<br />
digitalWrite(motorPin4, HIGH);<br />
}</p>
<p>if ( n == 97)<br />
{<br />
//Esquerda<br />
digitalWrite(motorPin1, HIGH);<br />
digitalWrite(motorPin2, LOW);<br />
digitalWrite(motorPin3, HIGH);<br />
digitalWrite(motorPin4, LOW);<br />
}</p>
<p>if (n == 113)<br />
{<br />
digitalWrite(motorPin1, LOW);<br />
digitalWrite(motorPin2, LOW);<br />
digitalWrite(motorPin3, LOW);<br />
digitalWrite(motorPin4, LOW);<br />
}<br />
}</p></blockquote>
<p>Utilizando este código no Arduino e recorrendo ao SerialMonitor é possível controlar os movimentos do RobóticTank, ainda que com algumas limitações e sendo necessário ter o cabo sempre conectado ao Arduino.</p>
<p style="text-align: center;"><img class="size-full wp-image-4505 aligncenter" title="Vlores digitados" src="/wp-content/uploads/2012/02/Vlores-digitados.jpg" alt="" width="376" height="360" /></p>
<p style="text-align: left;">Desta forma consegui alguns progressos e brevemente irei explorar as técnicas de &#8220;processing&#8221; que são mais indicadas para estas acções.</p>
<p style="text-align: left;">Aqui fica um pequeno vídeo com a demonstração dos resultados obtidos:</p>
<p><center><object style="height: 390px; width: 640px;" width="640" height="360" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="https://www.youtube.com/v/l7BkoI4D2GU?version=3&amp;feature=player_detailpage" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed style="height: 390px; width: 640px;" width="640" height="360" type="application/x-shockwave-flash" src="https://www.youtube.com/v/l7BkoI4D2GU?version=3&amp;feature=player_detailpage" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object></center>Nos próximos dias vou tentar evoluir um pouco mais esta solução e se possível recorrer à biblioteca “processing”!</p>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fomundodaprogramacao.com%2Fproject-robotictank-arduino-keyboard-controler%2F&amp;t=Project%20Rob%C3%B3ticTank%20-%20Arduino%20Keyboard%20Controler" id="facebook_share_button_4504" style="font-size:11px; line-height:13px; font-family:'lucida grande',tahoma,verdana,arial,sans-serif; text-decoration:none; display: -moz-inline-block; display:inline-block; padding:1px 20px 0 5px; margin: 5px 0; height:15px; border:1px solid #d8dfea; color: #3B5998; background: #fff url(http://b.static.ak.fbcdn.net/images/share/facebook_share_icon.gif) no-repeat top right;">Share</a>
	<script type="text/javascript">
	<!--
	var button = document.getElementById('facebook_share_link_4504') || document.getElementById('facebook_share_icon_4504') || document.getElementById('facebook_share_both_4504') || document.getElementById('facebook_share_button_4504');
	if (button) {
		button.onclick = function(e) {
			var url = this.href.replace(/share\.php/, 'sharer.php');
			window.open(url,'sharer','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	
		if (button.id === 'facebook_share_button_4504') {
			button.onmouseover = function(){
				this.style.color='#fff';
				this.style.borderColor = '#295582';
				this.style.backgroundColor = '#3b5998';
			}
			button.onmouseout = function(){
				this.style.color = '#3b5998';
				this.style.borderColor = '#d8dfea';
				this.style.backgroundColor = '#fff';
			}
		}
	}
	-->
	</script>
	]]></content:encoded>
			<wfw:commentRss>http://omundodaprogramacao.com/project-robotictank-arduino-keyboard-controler/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
