<?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; Free Software</title>
	<atom:link href="http://silveiraneto.net/tag/free-software/feed/" rel="self" type="application/rss+xml" />
	<link>http://silveiraneto.net</link>
	<description></description>
	<lastBuildDate>Fri, 09 Mar 2012 04:13:27 +0000</lastBuildDate>
	<language>pt-br</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Morse Code Translator with Arduino</title>
		<link>http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/</link>
		<comments>http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 16:16:58 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Arduino]]></category>
		<category><![CDATA[buzzer]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Diecimila]]></category>
		<category><![CDATA[embedded device]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Freeduino]]></category>
		<category><![CDATA[Open Hardware]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=2328</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/" title="Morse Code Translator with Arduino"></a>You write in your computer, sends a message thought USB and Arduino translates it into a Morse code. Just a Arduino board with a buzzer connected at the digital output 12 (one wire in the ground and the other in &#8230;<p class="read-more"><a href="http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/" title="Morse Code Translator with Arduino"></a><p>You write in your computer, sends a message thought USB and Arduino translates it into a <a href="http://en.wikipedia.org/wiki/Morse_code">Morse code</a>.</p>
<p style="text-align: center;"><object width="425" height="344" data="http://www.youtube.com/v/1_X5AwVrkUo&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/1_X5AwVrkUo&amp;hl=pt-br&amp;fs=1" /><param name="allowfullscreen" value="true" /></object></pre>
<p>Just a Arduino board with a buzzer connected at the digital output 12 (one wire in the ground and the other in the 12).</p>
<p style="text-align: center;"><img src='http://farm4.static.flickr.com/3495/3315777991_75f0f92578.jpg' alt='Arduino'/></pre>
<p>I tried to make the code as general as possible so you can easily adapt it for anthers ways of transmitting a Morse code. To do that you just need to rewrite a few functions.</p>
<p style="text-align: center;">
<pre>
                                                  +-------------------+
                                                  | 3) Interpretation |
                                                  +-------------------+
                                                  |   2) Translation  |
+-------------------+                             +-------------------+
|     Computer      |<========USB (Serial)=======>|     1) Reading    |
+-------------------+                             +-------------------+
</pre>
</p>
<ol>
<li>Reads a character from Serial. Main function loop().</li>
<li>Translate a ascii char into a Morse code using a reference table. A letter 'K' becomes a string word "-.-". Function say_char().</li>
<li>Interpret the Morse word as light and sound. Mostly at function say_morse_word(). The Interpretation needs 5 functions to say all Morse words, dot(), dash(), shortgap(), mediumgap() and intragap().</li>
</ol>
<p>For a more details on Morse code I strongly recommend the <a href="http://en.wikipedia.org/wiki/Morse_code">English Wikipedia article on it</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> led <span style="color: #339933;">=</span> <span style="color: #0000dd;">13</span><span style="color: #339933;">;</span>                   <span style="color: #666666; font-style: italic;">// LED connected to digital pin 13</span>
<span style="color: #993333;">int</span> buzzer <span style="color: #339933;">=</span> <span style="color: #0000dd;">12</span><span style="color: #339933;">;</span>                <span style="color: #666666; font-style: italic;">// buzzer connected to digital pin 12</span>
<span style="color: #993333;">int</span> unit <span style="color: #339933;">=</span> <span style="color: #0000dd;">50</span><span style="color: #339933;">;</span>                  <span style="color: #666666; font-style: italic;">// duration of a pulse</span>
&nbsp;
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span> morsecode<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: #ff0000;">&quot;-----&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 0</span>
    <span style="color: #ff0000;">&quot;.----&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 1</span>
    <span style="color: #ff0000;">&quot;..---&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 2</span>
    <span style="color: #ff0000;">&quot;...--&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 3</span>
    <span style="color: #ff0000;">&quot;....-&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 4</span>
    <span style="color: #ff0000;">&quot;.....&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 5</span>
    <span style="color: #ff0000;">&quot;-....&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 6 </span>
    <span style="color: #ff0000;">&quot;--...&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 7</span>
    <span style="color: #ff0000;">&quot;---..&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 8</span>
    <span style="color: #ff0000;">&quot;----.&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// 9</span>
    <span style="color: #ff0000;">&quot;---...&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// :</span>
    <span style="color: #ff0000;">&quot;-.-.-.&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// ;</span>
    <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">,</span>       <span style="color: #666666; font-style: italic;">// &lt; (there's no morse for this simbol)</span>
    <span style="color: #ff0000;">&quot;-...-&quot;</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// =</span>
    <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #339933;">,</span>       <span style="color: #666666; font-style: italic;">// &gt; (there's no morse for this simbol)</span>
    <span style="color: #ff0000;">&quot;..--..&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// ?</span>
    <span style="color: #ff0000;">&quot;.--._.&quot;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// @</span>
    <span style="color: #ff0000;">&quot;.-&quot;</span><span style="color: #339933;">,</span>     <span style="color: #666666; font-style: italic;">// A</span>
    <span style="color: #ff0000;">&quot;-...&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// B</span>
    <span style="color: #ff0000;">&quot;-.-.&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// C</span>
    <span style="color: #ff0000;">&quot;-..&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// D</span>
    <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #339933;">,</span>      <span style="color: #666666; font-style: italic;">// E</span>
    <span style="color: #ff0000;">&quot;..-.&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// F</span>
    <span style="color: #ff0000;">&quot;--.&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// G</span>
    <span style="color: #ff0000;">&quot;....&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// H</span>
    <span style="color: #ff0000;">&quot;..&quot;</span><span style="color: #339933;">,</span>     <span style="color: #666666; font-style: italic;">// I</span>
    <span style="color: #ff0000;">&quot;.---&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// J</span>
    <span style="color: #ff0000;">&quot;-.-&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// K</span>
    <span style="color: #ff0000;">&quot;.-..&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// L</span>
    <span style="color: #ff0000;">&quot;--&quot;</span><span style="color: #339933;">,</span>     <span style="color: #666666; font-style: italic;">// M</span>
    <span style="color: #ff0000;">&quot;-.&quot;</span><span style="color: #339933;">,</span>     <span style="color: #666666; font-style: italic;">// N</span>
    <span style="color: #ff0000;">&quot;---&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// O</span>
    <span style="color: #ff0000;">&quot;.--.&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// P</span>
    <span style="color: #ff0000;">&quot;--.-&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// Q</span>
    <span style="color: #ff0000;">&quot;.-.&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// R</span>
    <span style="color: #ff0000;">&quot;...&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// S</span>
    <span style="color: #ff0000;">&quot;-&quot;</span><span style="color: #339933;">,</span>      <span style="color: #666666; font-style: italic;">// T</span>
    <span style="color: #ff0000;">&quot;..-&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// U</span>
    <span style="color: #ff0000;">&quot;...-&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// V</span>
    <span style="color: #ff0000;">&quot;.--&quot;</span><span style="color: #339933;">,</span>    <span style="color: #666666; font-style: italic;">// W</span>
    <span style="color: #ff0000;">&quot;-..-&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// X</span>
    <span style="color: #ff0000;">&quot;-.--&quot;</span><span style="color: #339933;">,</span>   <span style="color: #666666; font-style: italic;">// Y</span>
    <span style="color: #ff0000;">&quot;--..&quot;</span>    <span style="color: #666666; font-style: italic;">// Z</span>
<span style="color: #009900;">&#125;</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>led<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  pinMode<span style="color: #009900;">&#40;</span>buzzer<span style="color: #339933;">,</span> OUTPUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">9600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> say_morse_word<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span> msg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> index <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// say a dash</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #ff0000;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      dash<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;">// say a dot</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #ff0000;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      dot<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;">// gap beetween simbols</span>
    intragap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    index<span style="color: #339933;">++;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// beep</span>
<span style="color: #993333;">void</span> beep<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> time<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> t <span style="color: #339933;">=</span> <span style="color: #0000dd;">100</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// period of the wav. bigger means lower pitch.</span>
  <span style="color: #993333;">int</span> beepduration <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">float</span><span style="color: #009900;">&#41;</span>time<span style="color: #339933;">/</span>t<span style="color: #339933;">*</span><span style="color: #0000dd;">1800</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>led<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>beepduration<span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>buzzer<span style="color: #339933;">,</span> HIGH<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delayMicroseconds<span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    digitalWrite<span style="color: #009900;">&#40;</span>buzzer<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delayMicroseconds<span style="color: #009900;">&#40;</span>t<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  delay<span style="color: #009900;">&#40;</span>time<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;">// silence</span>
<span style="color: #993333;">void</span> silence<span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> time<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  digitalWrite<span style="color: #009900;">&#40;</span>led<span style="color: #339933;">,</span> LOW<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  delay<span style="color: #009900;">&#40;</span>time<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;">// general procedure for .</span>
<span style="color: #993333;">void</span> dot<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  beep<span style="color: #009900;">&#40;</span>unit<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;">// general procedure for -</span>
<span style="color: #993333;">void</span> dash<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  beep<span style="color: #009900;">&#40;</span>unit<span style="color: #339933;">*</span><span style="color: #0000dd;">3</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;">// gap between dots and dashes</span>
<span style="color: #993333;">void</span> intragap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  silence<span style="color: #009900;">&#40;</span>unit<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;">// gap between letters</span>
<span style="color: #993333;">void</span> shortgap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  silence<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">3</span><span style="color: #339933;">*</span>unit<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;">// gap be  tween words</span>
<span style="color: #993333;">void</span> mediumgap<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  silence<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">7</span><span style="color: #339933;">*</span>unit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> say_char<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> letter<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>letter<span style="color: #339933;">&gt;=</span><span style="color: #ff0000;">'0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>letter<span style="color: #339933;">&lt;=</span><span style="color: #ff0000;">'Z'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>letter<span style="color: #339933;">!=</span><span style="color: #ff0000;">'&lt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><span style="color: #009900;">&#40;</span>letter<span style="color: #339933;">!=</span><span style="color: #ff0000;">'&gt;'</span><span style="color: #009900;">&#41;</span><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>morsecode<span style="color: #009900;">&#91;</span>letter<span style="color: #339933;">-</span><span style="color: #ff0000;">'0'</span><span style="color: #009900;">&#93;</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: #ff0000;">' '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    say_morse_word<span style="color: #009900;">&#40;</span>morsecode<span style="color: #009900;">&#91;</span>letter<span style="color: #339933;">-</span><span style="color: #ff0000;">'0'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    shortgap<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: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>letter<span style="color: #339933;">==</span><span style="color: #ff0000;">' '</span><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; <span style="color: #000099; font-weight: bold;">\\</span> &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      mediumgap<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: #b1b100;">else</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;X&quot;</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: #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: #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>
    say_char<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #009900;">&#41;</span>Serial.<span style="color: #202020;">read</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></div></div>

<p>Additionally you can put another function to say entire strings, like say_string("HELLO WORLD")</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span> say_string<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span> asciimsg<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> index <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">char</span> charac<span style="color: #339933;">;</span>  
  charac <span style="color: #339933;">=</span> asciimsg<span style="color: #009900;">&#91;</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>charac<span style="color: #339933;">!=</span><span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    say_char<span style="color: #009900;">&#40;</span>morsecode<span style="color: #009900;">&#91;</span>charac<span style="color: #339933;">-</span><span style="color: #ff0000;">'0'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Serial.<span style="color: #202020;">println</span><span style="color: #009900;">&#40;</span>morsecode<span style="color: #009900;">&#91;</span>charac<span style="color: #339933;">-</span><span style="color: #ff0000;">'0'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    charac <span style="color: #339933;">=</span> asciimsg<span style="color: #009900;">&#91;</span><span style="color: #339933;">++</span>index<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    shortgap<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></pre></div></div>

<p>You can use the Arduino IDE itself or any other program that talks with the serial port USB.</p>
<p style="text-align: center;"><a href="http://silveiraneto.net/wp-content/uploads/2009/02/arduino_interface.png"><img src="http://silveiraneto.net/wp-content/uploads/2009/02/arduino_interface.png" alt="arduino interface" title="arduino interface" width="545" height="585" class="alignnone size-full wp-image-2342" /></a></pre>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2009/02/28/morse-code-translator-with-arduino/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>OpenSolaris at InfoBrasil 2008</title>
		<link>http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/</link>
		<comments>http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/#comments</comments>
		<pubDate>Sat, 17 May 2008 20:45:36 +0000</pubDate>
		<dc:creator>Silveira</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[DTrace]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[InfoBrasil]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Opensolaris]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[Sun Campus Ambassador]]></category>
		<category><![CDATA[Sun Microsystems]]></category>
		<category><![CDATA[zfs]]></category>
		<category><![CDATA[Zones]]></category>

		<guid isPermaLink="false">http://silveiraneto.net/?p=894</guid>
		<description><![CDATA[<a href="http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/" title="OpenSolaris at InfoBrasil 2008"></a>InfoBrasil is a tradicional IT business event in my city. This year we got a space for Open Source and Free Software where I did a presentation about OpenSolaris. I posted our grid yesterday. That was my first presentation about &#8230;<p class="read-more"><a href="http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/" title="OpenSolaris at InfoBrasil 2008"></a><p style="text-align: center;"><img class="aligncenter" src="http://farm4.static.flickr.com/3060/2497307057_d056b03481.jpg" alt="Me and people talking about OpenSolaris" width="500" height="375" /></p>
<p><a title="InfoBrasil" href="http://www.infobrasil.inf.br/">InfoBrasil</a> is a tradicional IT business event in my city. This year we got a space for Open Source and Free Software where I did a presentation about <a title="OpenSolaris.org" href="http://opensolaris.org">OpenSolaris</a>. I <a title="FLOSS Grid at InfoBrasil" href="http://silveiraneto.net/2008/05/15/eventos-de-software-livre-ainda-essa-semana/">posted our grid</a> yesterday.</p>
<p>That was my first presentation about OpenSolaris so I focused to showing that OpenSolaris 2008.5 is a  GNU/OpenSolaris distribution but you can access features like ZFS, DTrace and Zones. I used <a title="Download them here" href="http://silveiraneto.net/downloads/Tirthankar Das - opensolaris_introduction_PortAlegre_UG.odp">those slides </a>that <a title="Tirthankar's Blog" href="http://blogs.sun.com/tirthankar/">Tirthankar Das</a>, Solaris Cluster Engineering at Sun Microsystems, did for <a title="FISL 2008" href="http://silveiraneto.net/2008/05/10/fisl-2008/">FISL 2008</a>. Most of the audience was composed from students and they showed very impressed with ZFS. In my next OpenSolaris presentation I&#8217;ll try to focus more on ZFS demos. ;) Someone in the audience did a random number generator code live. We used it to prize some OpenSolaris gifts like tshirts and sticks. :D</p>
<p style="text-align: center;"><img class="aligncenter" src="http://farm3.static.flickr.com/2065/2498144240_6edd7d36fe.jpg" alt="OpenSolaris in action" width="500" height="375" /></p>
<p>I hope that for now on that we can use better this space and for establish a good dialog between communities, governments and enterprises.</p>
<p>All photos ares avaliable at <a title="Flickr" href="http://flickr.com/photos/silveiraneto/sets/72157605095876763/">my personal album for that event</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://silveiraneto.net/2008/05/17/opensolaris-at-infobrasil-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

