tag:blogger.com,1999:blog-81644308974622358042024-03-18T21:34:58.605-07:00Mis Primeros pasos en el HardwareMis Primeros pasos en el Hardwarejsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-8164430897462235804.post-35820514693890978172014-08-12T10:40:00.002-07:002014-09-08T04:15:24.609-07:00Aumentando el número de salidas digitales en Arduino<div style="text-align: center;">
<span style="font-size: large;">Aumentando el número de salidas digitales en Arduino</span></div>
En la reciente entrada "primeros experimentos con Arduino" hice un montaje que utilizaba un display 7 segmentos de 4 dígitos para mostrar datos numéricos. En ese momento tuve que utilizar una salida digital para cada uno de los siete segmentos del display y dos salidas más para controlar el dígito en el que se iba a mostrar el dato numérico. Evidentemente necesitar 9 salidas digitales para mostrar datos por un display 7 segmentos no es nada eficiente, teniendo en cuenta que nuestro arduino cuenta con sólo 14. Es por esto que necesitaba de algún método para poder utilizar el display con menos salidas digitales. Y es aquí donde entró en juego el registro de desplazamiento, que permite conversión de datos serie a paralelo y viceversa. En mi caso disponía de un registro de desplazamiento de serie a paralelo 74HC164D que obtuve (al igual que el display) del despiece de un TDT estropeado. Había olvidado un poco qué misión tenían los registros de desplazamiento, así que entre la múltiple información existente en internet utilicé <a href="http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html" target="_blank">éste tutorial de arduino con 7 segmentos</a> para refrescarme la memoria. Con el circuito integrado a mano y con los conocimientos de su funcionamiento sólo restaba por realizar la programación en Arduino. Y tengo que decir que más fácil es imposible, ya que existe una función en Arduino denominada ShiftOut en la cuál indicas cuál salida vas a utilizar como pin de datos, cuál como reloj, el orden (si usando el bit más significativo o el menos) y el byte que que quieres pasar. De esta forma, en lugar de 7 salidas digitales hemos utilizado 2.<br />
<br />
<br />
Un ejemplo de código pasa a ser algo tan reducido como<br />
<br />
-<br />
<script src="http://pastebin.com/embed_js.php?i=tfjBY79G"></script><br />
-<br />
<br />
Nota: 8/9/2014<br />
Hay un bug en el código, ya que el numero 2 y 3 estan mal calculados. se ha equivocado al calcular el número que hay que restar. Os comento como encontrar el número correcto:<br />
<br />
Para el 2:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_kty7K4v3ZIDDiAQLuGX4zbm4irz24ebCmy8L36YJjLq9Fdo0jhz0c4QJQOHCh9RFyHcJpK3mFTEBQ-W6DNVtvJZNyB3GXVvkaX0h6CkCWYMQi8YUZwqHDsmWBg57LaldQNHFTQHB7jgj/s1600/definiendo+el+2+para+display+digital.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_kty7K4v3ZIDDiAQLuGX4zbm4irz24ebCmy8L36YJjLq9Fdo0jhz0c4QJQOHCh9RFyHcJpK3mFTEBQ-W6DNVtvJZNyB3GXVvkaX0h6CkCWYMQi8YUZwqHDsmWBg57LaldQNHFTQHB7jgj/s1600/definiendo+el+2+para+display+digital.JPG" height="225" width="320" /></a></div>
<br />
<br />
<br />
Para el 3:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJJJWrYkJHgGkvXyJjGLCdhcneyYVSoVo_q4rx1iG4jVI1an07srih96utlaNM9lPtiCvQHu6qXr_Mu_6n_qaE3Apxb8cn6A-95bT93Go78EyrXpMvsF76PGRfsd4bEkv6K95hXtgqXn9n/s1600/definiendo+el+3+para+display+digital.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJJJWrYkJHgGkvXyJjGLCdhcneyYVSoVo_q4rx1iG4jVI1an07srih96utlaNM9lPtiCvQHu6qXr_Mu_6n_qaE3Apxb8cn6A-95bT93Go78EyrXpMvsF76PGRfsd4bEkv6K95hXtgqXn9n/s1600/definiendo+el+3+para+display+digital.JPG" height="221" width="320" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
Fuente Original:<br />
<a href="http://geekenformacion.blogspot.com.es/2012/12/aumentando-el-numero-de-salidas.html#gpluscomments">http://geekenformacion.blogspot.com.es/2012/12/aumentando-el-numero-de-salidas.html#gpluscomments</a><br />
<br />
<br />
Otro entrada interesante:<br />
<br />
<h3 class="post-title entry-title" style="font-family: 'Trebuchet MS', Trebuchet, sans-serif; font-size: 30px; font-weight: normal; margin: 0px; position: relative;">
Registros de desplazamiento utilizando Arduino</h3>
<div class="post-header" style="color: #997755; line-height: 1.6; margin: 0px 0px 1em;">
<div class="post-header-line-1">
</div>
</div>
<div class="post-body entry-content" id="post-body-4435050541794639082" style="font-size: 14px; line-height: 1.5; position: relative; width: 618px;">
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Para nuestro proyecto de Arduino, es necesario aprender a utilizar y como poder manejar muy pocas entradas del Arduino para controlar más salidas, por lo que para esta entrada hablaré del registro de desplazamiento que vamos a utilizar en el cubo de leds, en donde mostraré un ejemplo en donde tenemos con solamente 4 salidas del arduino, controlar 16 Leds.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Un registro de desplazamiento se puede utilizar para controlar 8 salidas simultaneas usando unos pocos pines del microcontrolador, incluso es posible conectar dos demultiplexores y sacar 16 salidas, que es lo que hicimos para esta entrada.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">El integrado 74HC595, lo compramos en </span><a href="http://www.agelectronica.com/" style="background-color: white; color: #993222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-decoration: none;">AG electronica</a><span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;"> y este integrado es un registro de desplazamiento de 8 bits con entrada serie, salida serie o paralelo con latch (o sea, bloqueos), de 3 estados.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<b style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;"><span style="font-size: medium;">¿Cómo funciona?</span></b><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Este integrado funciona de la siguiente manera, utiliza comunicación serie sincrona, en donde tu puedes transmitir un byte enviando pulsos altos y bajos por un pin y otro pin, viene siendo el clock o reloj en donde va enviando pulsos constantes para ir diferenciando los bits enviados por el pin que envia los pulsos diferentes, por lo que este es muy diferente a una comunicación serial asicrona ya que utilizando la función Serial.begin() el emisor y el receptor fijan la forma de una velocidad de tranferencia, por lo que a diferencia, este una vez que le enviamos el byte completo al registro, los valores ya sean los altos o los bajos, se lo asignan a cada pin de salida, provocando una salida en paralelo.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">La salida en serie de este integrado es el agregr un pin extra que retransmite la información que le estamos mandando del arduino sin cambios, por lo que podemos como comunicar dos de estos integrados y tener la capacidad de transmitir 16 bits donde los primeros 8 bits atraviesen al primero y después se almacenen en el segundo, esto es lo que hicimos como ejemplo.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Bueno este es la información de los pines del integrado que utilizamos, tomado de </span><a href="http://arduino.cc/es/uploads/Tutorial/595datasheet.pdf" style="background-color: white; color: #993222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-decoration: none;">aquí</a><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<table border="1" bordercolor="#CCCCCC" cellpadding="5" cellspacing="0" style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 20.285999298095703px;"><tbody>
<tr><td rowspan="9" valign="top"><img alt="" src="http://arduino.cc/es/uploads/Tutorial/595_pin_diagram.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px;" title="" /></td><td valign="top">PINS 1-7, 15</td><td valign="top">Q0 " Q7</td><td valign="top">Pins de salida</td></tr>
<tr><td valign="top">PIN 8</td><td valign="top">GND</td><td valign="top">Ground, Vss</td></tr>
<tr><td valign="top">PIN 9</td><td valign="top">Q7"</td><td valign="top">Salida Serie</td></tr>
<tr><td valign="top">PIN 10</td><td valign="top">MR</td><td valign="top">Master Reset, activo = low</td></tr>
<tr><td valign="top">PIN 11</td><td valign="top">SH_CP</td><td valign="top">Pin Clock</td></tr>
<tr><td valign="top">PIN 12</td><td valign="top">ST_CP</td><td valign="top">Pin Latch</td></tr>
<tr><td valign="top">PIN 13</td><td valign="top">OE</td><td valign="top">Salida disponible, activo = low</td></tr>
<tr><td valign="top">PIN 14</td><td valign="top">DS</td><td valign="top">Entrada Serie</td></tr>
<tr><td valign="top">PIN 16</td><td valign="top">Vcc</td><td valign="top">Voltaje</td></tr>
</tbody></table>
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Para checar como funciona, es preferible hacer un programa que nos ayude a probar los integrados y de las conexiones, por lo que utilizamos este diagrama de circuito, con 16 LEDs, 16 resistencias de 220 Ohm, dos integrados demultiplexores 595 y un condensador 0.1 uf o 100 nF.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Este es el diagrama.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="http://arduino.cc/es/uploads/Tutorial/ShftOut_Schm2.gif" imageanchor="1" style="clear: left; color: #993222; float: left; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><br /></a><a href="http://arduino.cc/es/uploads/Tutorial/ShftOut_Schm2.gif" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://arduino.cc/es/uploads/Tutorial/ShftOut_Schm2.gif" height="701" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="550" /></a></div>
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;"><br /></span>
<br />
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: -webkit-auto;">
Para verlo mejor o más grafico, estas son las conexiones utilizando 3 protoboards.</div>
<div style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: -webkit-auto;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="http://arduino.cc/es/uploads/Tutorial/ShftOutExmp2_3.gif" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://arduino.cc/es/uploads/Tutorial/ShftOutExmp2_3.gif" height="599" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="599" /></a></div>
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Y este es el código que realizamos para verificar su funcionamiento.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<div class="gist" id="gist2564292" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">
<div class="gist-file" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(204, 204, 204); border-style: solid; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; font-family: Consolas, 'Liberation Mono', Courier, monospace; margin-bottom: 1em;">
<div class="gist-data gist-syntax" style="background-color: ghostwhite; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; overflow: auto; word-wrap: normal;">
<div class="file-data">
<table cellpadding="0" cellspacing="0" class="lines highlight"><tbody>
<tr><td class="line-numbers" style="background-color: #ececec; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; color: #aaaaaa; padding: 0.5em; text-align: right;"><span class="line-number" id="file-gistfile1-c-L1" rel="file-gistfile1-c-L1" style="clear: right; display: block;">1</span><span class="line-number" id="file-gistfile1-c-L2" rel="file-gistfile1-c-L2" style="clear: right; display: block;">2</span><span class="line-number" id="file-gistfile1-c-L3" rel="file-gistfile1-c-L3" style="clear: right; display: block;">3</span><span class="line-number" id="file-gistfile1-c-L4" rel="file-gistfile1-c-L4" style="clear: right; display: block;">4</span><span class="line-number" id="file-gistfile1-c-L5" rel="file-gistfile1-c-L5" style="clear: right; display: block;">5</span><span class="line-number" id="file-gistfile1-c-L6" rel="file-gistfile1-c-L6" style="clear: right; display: block;">6</span><span class="line-number" id="file-gistfile1-c-L7" rel="file-gistfile1-c-L7" style="clear: right; display: block;">7</span><span class="line-number" id="file-gistfile1-c-L8" rel="file-gistfile1-c-L8" style="clear: right; display: block;">8</span><span class="line-number" id="file-gistfile1-c-L9" rel="file-gistfile1-c-L9" style="clear: right; display: block;">9</span><span class="line-number" id="file-gistfile1-c-L10" rel="file-gistfile1-c-L10" style="clear: right; display: block;">10</span><span class="line-number" id="file-gistfile1-c-L11" rel="file-gistfile1-c-L11" style="clear: right; display: block;">11</span><span class="line-number" id="file-gistfile1-c-L12" rel="file-gistfile1-c-L12" style="clear: right; display: block;">12</span><span class="line-number" id="file-gistfile1-c-L13" rel="file-gistfile1-c-L13" style="clear: right; display: block;">13</span><span class="line-number" id="file-gistfile1-c-L14" rel="file-gistfile1-c-L14" style="clear: right; display: block;">14</span><span class="line-number" id="file-gistfile1-c-L15" rel="file-gistfile1-c-L15" style="clear: right; display: block;">15</span><span class="line-number" id="file-gistfile1-c-L16" rel="file-gistfile1-c-L16" style="clear: right; display: block;">16</span><span class="line-number" id="file-gistfile1-c-L17" rel="file-gistfile1-c-L17" style="clear: right; display: block;">17</span><span class="line-number" id="file-gistfile1-c-L18" rel="file-gistfile1-c-L18" style="clear: right; display: block;">18</span><span class="line-number" id="file-gistfile1-c-L19" rel="file-gistfile1-c-L19" style="clear: right; display: block;">19</span><span class="line-number" id="file-gistfile1-c-L20" rel="file-gistfile1-c-L20" style="clear: right; display: block;">20</span><span class="line-number" id="file-gistfile1-c-L21" rel="file-gistfile1-c-L21" style="clear: right; display: block;">21</span><span class="line-number" id="file-gistfile1-c-L22" rel="file-gistfile1-c-L22" style="clear: right; display: block;">22</span><span class="line-number" id="file-gistfile1-c-L23" rel="file-gistfile1-c-L23" style="clear: right; display: block;">23</span><span class="line-number" id="file-gistfile1-c-L24" rel="file-gistfile1-c-L24" style="clear: right; display: block;">24</span><span class="line-number" id="file-gistfile1-c-L25" rel="file-gistfile1-c-L25" style="clear: right; display: block;">25</span><span class="line-number" id="file-gistfile1-c-L26" rel="file-gistfile1-c-L26" style="clear: right; display: block;">26</span><span class="line-number" id="file-gistfile1-c-L27" rel="file-gistfile1-c-L27" style="clear: right; display: block;">27</span><span class="line-number" id="file-gistfile1-c-L28" rel="file-gistfile1-c-L28" style="clear: right; display: block;">28</span><span class="line-number" id="file-gistfile1-c-L29" rel="file-gistfile1-c-L29" style="clear: right; display: block;">29</span><span class="line-number" id="file-gistfile1-c-L30" rel="file-gistfile1-c-L30" style="clear: right; display: block;">30</span><span class="line-number" id="file-gistfile1-c-L31" rel="file-gistfile1-c-L31" style="clear: right; display: block;">31</span><span class="line-number" id="file-gistfile1-c-L32" rel="file-gistfile1-c-L32" style="clear: right; display: block;">32</span><span class="line-number" id="file-gistfile1-c-L33" rel="file-gistfile1-c-L33" style="clear: right; display: block;">33</span><span class="line-number" id="file-gistfile1-c-L34" rel="file-gistfile1-c-L34" style="clear: right; display: block;">34</span><span class="line-number" id="file-gistfile1-c-L35" rel="file-gistfile1-c-L35" style="clear: right; display: block;">35</span><span class="line-number" id="file-gistfile1-c-L36" rel="file-gistfile1-c-L36" style="clear: right; display: block;">36</span><span class="line-number" id="file-gistfile1-c-L37" rel="file-gistfile1-c-L37" style="clear: right; display: block;">37</span></td><td class="line-data" style="padding: 0.5em !important;"><pre class="line-pre" style="background-color: transparent !important; border: none !important; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; padding: 0px !important;"><div class="line" id="file-gistfile1-c-LC1">
<span class="k" style="font-weight: bold;">const</span> <span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">latchPin</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">8</span><span class="p">;</span></div>
<div class="line" id="file-gistfile1-c-LC2">
<span class="k" style="font-weight: bold;">const</span> <span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">clockPin</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">12</span><span class="p">;</span></div>
<div class="line" id="file-gistfile1-c-LC3">
<span class="k" style="font-weight: bold;">const</span> <span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">dataPin</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">11</span><span class="p">;</span></div>
<div class="line" id="file-gistfile1-c-LC4">
</div>
<div class="line" id="file-gistfile1-c-LC5">
<span class="kt" style="color: #445588; font-weight: bold;">char</span> <span class="n">inputString</span><span class="p">[</span><span class="mi" style="color: #009999;">2</span><span class="p">];</span></div>
<div class="line" id="file-gistfile1-c-LC6">
<span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">arreglo</span><span class="p">[]</span> <span class="o" style="font-weight: bold;">=</span> <span class="p">{</span><span class="mi" style="color: #009999;">2</span><span class="p">,</span><span class="mi" style="color: #009999;">4</span><span class="p">,</span><span class="mi" style="color: #009999;">6</span><span class="p">,</span><span class="mi" style="color: #009999;">8</span><span class="p">,</span><span class="mi" style="color: #009999;">10</span><span class="p">,</span><span class="mi" style="color: #009999;">12</span><span class="p">,</span><span class="mi" style="color: #009999;">14</span><span class="p">};</span></div>
<div class="line" id="file-gistfile1-c-LC7">
<span class="kt" style="color: #445588; font-weight: bold;">unsigned</span> <span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">bitsToSend</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">0</span><span class="p">;</span> </div>
<div class="line" id="file-gistfile1-c-LC8">
</div>
<div class="line" id="file-gistfile1-c-LC9">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">setup</span><span class="p">()</span> <span class="p">{</span></div>
<div class="line" id="file-gistfile1-c-LC10">
<span class="n">pinMode</span><span class="p">(</span><span class="n">latchPin</span><span class="p">,</span> <span class="n">OUTPUT</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC11">
<span class="n">pinMode</span><span class="p">(</span><span class="n">dataPin</span><span class="p">,</span> <span class="n">OUTPUT</span><span class="p">);</span> </div>
<div class="line" id="file-gistfile1-c-LC12">
<span class="n">pinMode</span><span class="p">(</span><span class="n">clockPin</span><span class="p">,</span> <span class="n">OUTPUT</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC13">
<span class="n">Serial</span><span class="p">.</span><span class="n">begin</span><span class="p">(</span><span class="mi" style="color: #009999;">9600</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC14">
<span class="n">Serial</span><span class="p">.</span><span class="n">println</span><span class="p">(</span><span class="s" style="color: #dd1144;">"reset"</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC15">
<span class="p">}</span></div>
<div class="line" id="file-gistfile1-c-LC16">
</div>
<div class="line" id="file-gistfile1-c-LC17">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">loop</span><span class="p">()</span> <span class="p">{</span></div>
<div class="line" id="file-gistfile1-c-LC18">
<span class="k" style="font-weight: bold;">for</span><span class="p">(</span><span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">pos</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">0</span><span class="p">;</span> <span class="n">pos</span><span class="o" style="font-weight: bold;"><</span><span class="mi" style="color: #009999;">7</span><span class="p">;</span> <span class="n">pos</span><span class="o" style="font-weight: bold;">++</span><span class="p">){</span></div>
<div class="line" id="file-gistfile1-c-LC19">
<span class="n">registerWrite</span><span class="p">(</span><span class="n">arreglo</span><span class="p">[</span><span class="n">pos</span><span class="p">]);</span></div>
<div class="line" id="file-gistfile1-c-LC20">
<span class="n">delay</span><span class="p">(</span><span class="mi" style="color: #009999;">200</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC21">
<span class="p">}</span></div>
<div class="line" id="file-gistfile1-c-LC22">
</div>
<div class="line" id="file-gistfile1-c-LC23">
<span class="p">}</span></div>
<div class="line" id="file-gistfile1-c-LC24">
</div>
<div class="line" id="file-gistfile1-c-LC25">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">registerWrite</span><span class="p">(</span><span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">pos</span><span class="p">)</span> <span class="p">{</span></div>
<div class="line" id="file-gistfile1-c-LC26">
<span class="n">digitalWrite</span><span class="p">(</span><span class="n">latchPin</span><span class="p">,</span> <span class="n">LOW</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC27">
<span class="n">bitWrite</span><span class="p">(</span><span class="n">bitsToSend</span><span class="p">,</span> <span class="n">pos</span><span class="p">,</span> <span class="n">HIGH</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC28">
</div>
<div class="line" id="file-gistfile1-c-LC29">
<span class="n">byte</span> <span class="n">registerOne</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">highByte</span><span class="p">(</span><span class="n">bitsToSend</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC30">
<span class="n">byte</span> <span class="n">registerTwo</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">lowByte</span><span class="p">(</span><span class="n">bitsToSend</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC31">
</div>
<div class="line" id="file-gistfile1-c-LC32">
<span class="n">shiftOut</span><span class="p">(</span><span class="n">dataPin</span><span class="p">,</span> <span class="n">clockPin</span><span class="p">,</span> <span class="n">MSBFIRST</span><span class="p">,</span> <span class="n">registerTwo</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC33">
<span class="n">shiftOut</span><span class="p">(</span><span class="n">dataPin</span><span class="p">,</span> <span class="n">clockPin</span><span class="p">,</span> <span class="n">MSBFIRST</span><span class="p">,</span> <span class="n">registerOne</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC34">
</div>
<div class="line" id="file-gistfile1-c-LC35">
<span class="n">digitalWrite</span><span class="p">(</span><span class="n">latchPin</span><span class="p">,</span> <span class="n">HIGH</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC36">
<span class="n">delay</span><span class="p">(</span><span class="mi" style="color: #009999;">300</span><span class="p">);</span></div>
<div class="line" id="file-gistfile1-c-LC37">
<span class="p">}</span></div>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
<div class="gist-meta" style="background-color: #e8e8e8; background-image: linear-gradient(rgb(250, 250, 250), rgb(232, 232, 232)); background-repeat: repeat no-repeat; color: #999999; font-family: 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: normal; overflow: hidden; padding: 10px; text-shadow: rgba(255, 255, 255, 0.8) 1px 1px;">
<a href="https://gist.github.com/anonymous/2564292/raw/gistfile1.c" style="color: #666666; float: right; font-weight: bold; text-decoration: none;">view raw</a><a href="https://gist.github.com/anonymous/2564292#file-gistfile1-c" style="color: #666666; font-weight: bold; text-decoration: none;">gistfile1.c</a> hosted with ❤ by <a href="https://github.com/" style="color: #666666; font-weight: bold; text-decoration: none;">GitHub</a></div>
</div>
</div>
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">En donde podemos ver que tenemos un arreglo con los leds que queremos prender y este los va leyendo y pasando la información a los integrados para que realicen su función.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">En esta liga </span><a href="http://arduino.cc/en/Tutorial/ShiftOut" style="background-color: white; color: #993222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-decoration: none;">aquí</a><span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;"> vienen algunos ejemplos, pero nos dimos cuenta que algunos no funcionaban, por lo que nos dimos la tarea de realizar un programa por nosotro mismos, en base a los ejemplos.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;">Estos fueron los resultados.</span><br />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<br style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px;" />
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje_wBWX6Qrj-9LK-VU1KdS7R49V2g7jvliSMa_ViGenxmPuLp71KkGFFyFWdV3L9_5YhRyuiY3JGIZpdv3gAwwbbTan57LcGWdH3Xa-HUIJuwtK9SiBet4wbiyu8ObztpPIXdKKRdJ5P4p/s1600/DSCF1033.JPG" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEje_wBWX6Qrj-9LK-VU1KdS7R49V2g7jvliSMa_ViGenxmPuLp71KkGFFyFWdV3L9_5YhRyuiY3JGIZpdv3gAwwbbTan57LcGWdH3Xa-HUIJuwtK9SiBet4wbiyu8ObztpPIXdKKRdJ5P4p/s320/DSCF1033.JPG" height="238" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="320" /></a></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBv-SRQpBSx7fOCGlUgL2O4B1G0BAOXS2-yKhQ0-zRyS3HcuuSDDowxLgwhJsbB-9dphPi1VyL5vrMAj0vZZk5appSUZUlF1VLulKanVjZcdUkMm_FArkavN3KXzN7WpIhM7UEaplOV79n/s1600/DSCF1034.JPG" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBv-SRQpBSx7fOCGlUgL2O4B1G0BAOXS2-yKhQ0-zRyS3HcuuSDDowxLgwhJsbB-9dphPi1VyL5vrMAj0vZZk5appSUZUlF1VLulKanVjZcdUkMm_FArkavN3KXzN7WpIhM7UEaplOV79n/s320/DSCF1034.JPG" height="238" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="320" /></a></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip4PB6leT21HCm2rpLJpY6NthhUrQAb7ZU8cRykcetOMtCdbWYuqCBOzBexcWC06RsSpmeMcUkhA4L4SWUjd0LzWxbptkj0y6bnaxgN3im2T62CSqZtCqiNT1826ZWSlyweRTkdMmgbMkc/s1600/DSCF1035.JPG" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEip4PB6leT21HCm2rpLJpY6NthhUrQAb7ZU8cRykcetOMtCdbWYuqCBOzBexcWC06RsSpmeMcUkhA4L4SWUjd0LzWxbptkj0y6bnaxgN3im2T62CSqZtCqiNT1826ZWSlyweRTkdMmgbMkc/s320/DSCF1035.JPG" height="238" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="320" /></a></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<br /></div>
<div class="separator" style="background-color: white; clear: both; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 20.285999298095703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzYZH53K4kuLn_kZJVNwXV5MEx7lT7S0yl32qV9QBEZN55dxHurINZR-nFO451ffemjjOnsyXz5QZJTuxYbf-TWQb3eojXJ_T7khMaw2JO7YQ6dypO3-WsFuLxd8PF4qm6NnBMJEhbcd1Z/s1600/DSCF1036.JPG" imageanchor="1" style="color: #993222; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzYZH53K4kuLn_kZJVNwXV5MEx7lT7S0yl32qV9QBEZN55dxHurINZR-nFO451ffemjjOnsyXz5QZJTuxYbf-TWQb3eojXJ_T7khMaw2JO7YQ6dypO3-WsFuLxd8PF4qm6NnBMJEhbcd1Z/s320/DSCF1036.JPG" height="238" style="-webkit-box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; border: none; box-shadow: rgba(0, 0, 0, 0.498039) 1px 1px 5px; padding: 8px; position: relative;" width="320" /></a></div>
<div>
<br /></div>
<div>
Fuente:</div>
</div>
<a href="http://roberto-mtz.blogspot.com.es/2012/04/registros-de-desplazamiento-utilizando.html">http://roberto-mtz.blogspot.com.es/2012/04/registros-de-desplazamiento-utilizando.html</a><br />
<br />
<br />
<br />
Otra entrada curiosa: usando otro arduino:<br />
<h3 class="post-title entry-title" itemprop="name" style="background-color: white; color: #0b487f; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 22px; margin: 0px; position: relative; text-align: justify;">
Aumentar Pines Digitales en Arduino Uno</h3>
<div class="post-header" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 1.6; margin: 0px 0px 1em; text-align: justify;">
<div class="post-header-line-1">
</div>
</div>
<div class="post-body entry-content" id="post-body-6598773069592666621" itemprop="description articleBody" style="background-color: white; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 14px; line-height: 19.600000381469727px; position: relative; text-align: justify; width: 636px;">
<table style="float: right; margin: auto;"><tbody>
<tr><td><b>Cómputo Integrado</b><br />
<b>Laboratorio</b></td><td><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuC92T1yRi82fozr43rb4zF99HwlehX6Sc6DSawa6Q2xIpQom0PSxC2lm1sf9xXJfFQW5x4n5o_QDXnqFvCL43t4lG4HOGlBAGCmo7uOoTfVh07ZlBZb_NXABpy-5cCupGR5P-chxFg6c/s200/blockblue.png" height="100" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; padding: 8px;" width="100" /></td></tr>
</tbody></table>
<div class="clear" style="clear: both;">
</div>
Mientras experimentaba un poco con mi Arduino Uno encontré información valiosa en internet, acerca del uso de los pines que tenemos disponibles.<br />
<br />
Una de las cosas con las que aveces lidiamos es la cantidad de salidas/entradas digitales en nuestra placa Arduino, pero podemos hacer un poco de maravillas con ella sin necesidad de comprar un componente más. Esto es usando todos los pines como salidas o entradas digitales.<br />
<br />
Mi compañera Cecilia Urbina hizo una entrada para aumentar en número de pines pero cuando se tiene a la mano otro Arduino.<br />
<br />
Enlace directo a la publicación: <a href="http://cecilia-urbina.blogspot.mx/2012/05/otra-opcion-aumentar-io-arduino.html" style="color: #0b5394; text-decoration: none;">Aumentar I/O en Arduino</a><br />
<br />
Veamos como están distribuidas las entradas y salidas digitales, seriales y analógicas de nuestra placa de Arduino Uno.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieSR5C2VBCb5mVgJlgkyznJg9FkpI8BAOuYM61MJAgScIIT6HaEJxMXfEefp32QiC8JwKU54BGOPHfSD3Xlzdu3EAII-J2osn7IMDrRgXm52LA2zyvU6hg-4SOItx97965sIDFpf_jhE0/s1600/ardpins-01.png" imageanchor="1" style="color: #0b5394; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieSR5C2VBCb5mVgJlgkyznJg9FkpI8BAOuYM61MJAgScIIT6HaEJxMXfEefp32QiC8JwKU54BGOPHfSD3Xlzdu3EAII-J2osn7IMDrRgXm52LA2zyvU6hg-4SOItx97965sIDFpf_jhE0/s400/ardpins-01.png" height="285" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 20px; padding: 8px; position: relative;" width="400" /></a></div>
<br />
De forma predeterminada los pines del Arduino están distribuidos de la siguiente manera.<br />
<ul style="line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;">
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">Terminales digitales 0-1 E/S serie - TX/RX (verde oscuro).</li>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">Terminales digitales 2-13 (color verde).</li>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">Terminales de entrada analógica 0-5 (azul claro).</li>
</ul>
<br />
Pero algo que es bueno saber cuando se necesitan más entradas o salidas digitales es que las terminales 0 y 1 (TX y RX) si no estan siendo utilizadas como salidas seriales, como por ejemplo, usando <b>Serial.begin(9600);</b> pueden usarse sin problema como salidas digitales donde podemos usar <b>digitalWrite();</b>.<br />
<br />
Y también tenemos 6 entradas analógicas (A0 - A5) que podemos utilizar, siempre y cuando no estemos usando ninguna de ellas para la lectura de algún sensor, ya que con una sola terminal que necesitemos para un sensor, en automático todos los demás también se activan para el mismo uso. Así que mientras no usemos ningún sensor, hemos ganado 6 entradas y salidas digitales.<br />
<br />
Cree un pequeño ejemplo donde utilizo todas las terminales del Arduino para prender leds.<br />
<br />
<div class="gist" id="gist2759910">
<div class="gist-file" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(204, 204, 204); border-style: solid; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; font-family: Consolas, 'Liberation Mono', Courier, monospace; margin-bottom: 1em;">
<div class="gist-data gist-syntax" style="background-color: ghostwhite; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; overflow: auto; word-wrap: normal;">
<div class="file-data">
<table cellpadding="0" cellspacing="0" class="lines highlight"><tbody>
<tr><td class="line-numbers" style="background-color: #ececec; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; color: #aaaaaa; padding: 0.5em; text-align: right;"><span class="line-number" id="file-pinesdigitales-pde-L1" rel="file-pinesdigitales-pde-L1" style="clear: right; display: block;">1</span><span class="line-number" id="file-pinesdigitales-pde-L2" rel="file-pinesdigitales-pde-L2" style="clear: right; display: block;">2</span><span class="line-number" id="file-pinesdigitales-pde-L3" rel="file-pinesdigitales-pde-L3" style="clear: right; display: block;">3</span><span class="line-number" id="file-pinesdigitales-pde-L4" rel="file-pinesdigitales-pde-L4" style="clear: right; display: block;">4</span><span class="line-number" id="file-pinesdigitales-pde-L5" rel="file-pinesdigitales-pde-L5" style="clear: right; display: block;">5</span><span class="line-number" id="file-pinesdigitales-pde-L6" rel="file-pinesdigitales-pde-L6" style="clear: right; display: block;">6</span><span class="line-number" id="file-pinesdigitales-pde-L7" rel="file-pinesdigitales-pde-L7" style="clear: right; display: block;">7</span><span class="line-number" id="file-pinesdigitales-pde-L8" rel="file-pinesdigitales-pde-L8" style="clear: right; display: block;">8</span><span class="line-number" id="file-pinesdigitales-pde-L9" rel="file-pinesdigitales-pde-L9" style="clear: right; display: block;">9</span><span class="line-number" id="file-pinesdigitales-pde-L10" rel="file-pinesdigitales-pde-L10" style="clear: right; display: block;">10</span><span class="line-number" id="file-pinesdigitales-pde-L11" rel="file-pinesdigitales-pde-L11" style="clear: right; display: block;">11</span><span class="line-number" id="file-pinesdigitales-pde-L12" rel="file-pinesdigitales-pde-L12" style="clear: right; display: block;">12</span><span class="line-number" id="file-pinesdigitales-pde-L13" rel="file-pinesdigitales-pde-L13" style="clear: right; display: block;">13</span><span class="line-number" id="file-pinesdigitales-pde-L14" rel="file-pinesdigitales-pde-L14" style="clear: right; display: block;">14</span><span class="line-number" id="file-pinesdigitales-pde-L15" rel="file-pinesdigitales-pde-L15" style="clear: right; display: block;">15</span><span class="line-number" id="file-pinesdigitales-pde-L16" rel="file-pinesdigitales-pde-L16" style="clear: right; display: block;">16</span><span class="line-number" id="file-pinesdigitales-pde-L17" rel="file-pinesdigitales-pde-L17" style="clear: right; display: block;">17</span><span class="line-number" id="file-pinesdigitales-pde-L18" rel="file-pinesdigitales-pde-L18" style="clear: right; display: block;">18</span><span class="line-number" id="file-pinesdigitales-pde-L19" rel="file-pinesdigitales-pde-L19" style="clear: right; display: block;">19</span><span class="line-number" id="file-pinesdigitales-pde-L20" rel="file-pinesdigitales-pde-L20" style="clear: right; display: block;">20</span><span class="line-number" id="file-pinesdigitales-pde-L21" rel="file-pinesdigitales-pde-L21" style="clear: right; display: block;">21</span><span class="line-number" id="file-pinesdigitales-pde-L22" rel="file-pinesdigitales-pde-L22" style="clear: right; display: block;">22</span><span class="line-number" id="file-pinesdigitales-pde-L23" rel="file-pinesdigitales-pde-L23" style="clear: right; display: block;">23</span><span class="line-number" id="file-pinesdigitales-pde-L24" rel="file-pinesdigitales-pde-L24" style="clear: right; display: block;">24</span><span class="line-number" id="file-pinesdigitales-pde-L25" rel="file-pinesdigitales-pde-L25" style="clear: right; display: block;">25</span><span class="line-number" id="file-pinesdigitales-pde-L26" rel="file-pinesdigitales-pde-L26" style="clear: right; display: block;">26</span><span class="line-number" id="file-pinesdigitales-pde-L27" rel="file-pinesdigitales-pde-L27" style="clear: right; display: block;">27</span><span class="line-number" id="file-pinesdigitales-pde-L28" rel="file-pinesdigitales-pde-L28" style="clear: right; display: block;">28</span></td><td class="line-data" style="padding: 0.5em !important;"><pre class="line-pre" style="background-color: transparent !important; border: none !important; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; padding: 0px !important;"><div class="line" id="file-pinesdigitales-pde-LC1">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">setup</span><span class="o" style="font-weight: bold;">()</span> <span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-pinesdigitales-pde-LC2">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">0</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC3">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">1</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC4">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">2</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC5">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">3</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC6">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">4</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC7">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">5</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC8">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">6</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC9">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">7</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC10">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">8</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC11">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">9</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC12">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">10</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC13">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">11</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC14">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">12</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC15">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">13</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC16">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">14</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC17">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">15</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC18">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">16</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC19">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">17</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC20">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">18</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC21">
<span class="n">pinMode</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">19</span><span class="o" style="font-weight: bold;">,</span> <span class="n">OUTPUT</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC22">
<span class="o" style="font-weight: bold;">}</span></div>
<div class="line" id="file-pinesdigitales-pde-LC23">
</div>
<div class="line" id="file-pinesdigitales-pde-LC24">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">loop</span><span class="o" style="font-weight: bold;">()</span> <span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-pinesdigitales-pde-LC25">
<span class="k" style="font-weight: bold;">for</span> <span class="o" style="font-weight: bold;">(</span><span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">pin</span> <span class="o" style="font-weight: bold;">=</span> <span class="mi" style="color: #009999;">0</span><span class="o" style="font-weight: bold;">;</span> <span class="n">pin</span> <span class="o" style="font-weight: bold;"><</span> <span class="mi" style="color: #009999;">20</span><span class="o" style="font-weight: bold;">;</span> <span class="n">pin</span><span class="o" style="font-weight: bold;">++)</span> <span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-pinesdigitales-pde-LC26">
<span class="n">digitalWrite</span><span class="o" style="font-weight: bold;">(</span><span class="n">pin</span><span class="o" style="font-weight: bold;">,</span> <span class="n">HIGH</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-pinesdigitales-pde-LC27">
<span class="o" style="font-weight: bold;">}</span></div>
<div class="line" id="file-pinesdigitales-pde-LC28">
<span class="o" style="font-weight: bold;">}</span></div>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
<div class="gist-meta" style="background-color: #e8e8e8; background-image: linear-gradient(rgb(250, 250, 250), rgb(232, 232, 232)); background-repeat: repeat no-repeat; color: #999999; font-family: 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: normal; overflow: hidden; padding: 10px; text-shadow: rgba(255, 255, 255, 0.8) 1px 1px;">
<a href="https://gist.github.com/ramonesteban/2759910/raw/pinesdigitales.pde" style="color: #666666; float: right; font-weight: bold; text-decoration: none;">view raw</a><a href="https://gist.github.com/ramonesteban/2759910#file-pinesdigitales-pde" style="color: #666666; font-weight: bold; text-decoration: none;">pinesdigitales.pde</a> hosted with ❤ by <a href="https://github.com/" style="color: #666666; font-weight: bold; text-decoration: none;">GitHub</a></div>
</div>
</div>
<br />
Si podemos ver las terminales A0, A1, A2, A3, A4 y A5 son usadas como 14, 15, 16, 17, 18 y 19, al ser usadas en <b>pinMode();</b>.<br />
<br />
Y esto es una forma fácil de tener más salidas o entradas digitales en nuestro Arduino sin gastar en más componentes.</div>
<br />
<h3 class="post-title entry-title" itemprop="name" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 22px; margin: 0px; position: relative;">
Otra opción aumentar I/O Arduino</h3>
<div class="post-header" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.6; margin: 0px 0px 1em;">
<div class="post-header-line-1">
</div>
</div>
<div class="post-body entry-content" id="post-body-2300077609924293179" itemprop="description articleBody" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18.200000762939453px; position: relative; width: 586px;">
En esta entrada les compartiré una manera bastante simple de poder aumentar las entradas o salidas del Arduino sin necesidad de comprar shift registers, pero teniendo en cuenta que disponemos de 2 Arduinos, esto es el mejor camino para aumentar salidas o entradas cuando tenemos ArduInos de sobra :).<br />
Materiales que ocupamos:<br />
<br />
<br />
<ul style="line-height: 1.4; list-style-image: initial; list-style-position: initial; margin: 0.5em 0px; padding: 0px 2.5em;">
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">2 Arduinos</li>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">1 Led</li>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">4 cables </li>
<li style="border: none; margin: 0px 0px 0.25em; padding: 0.25em 0px;">Fuente de poder</li>
</ul>
<br />
<br />
Lo primero que vamos a hacer es conectar nuestros Arduinos de una manera muy simple:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://arduino.cc/en/uploads/Tutorial/Master_Sender_bb.png" imageanchor="1" style="color: #4d469c; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://arduino.cc/en/uploads/Tutorial/Master_Sender_bb.png" height="125" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" width="320" /></a></div>
<br />
<br />
Podemos ver que ocupamos los mismos puertos del Arduino master y del Arduino esclavo, conectamos la salida de 5v del master al esclavo, la salida GND del master al esclavo, y las entradas analógicas 4 y 5 del master al esclavo también a la 4 y 5.<br />
<br />
Ahora colocamos un led en el pin 13 del Arduino esclavo, ya que nuestro programa tendrá como propósito apagar y prender un led.<br />
<br />
Ahora programamos para el Arduino master:<br />
<br />
<div class="gist" id="gist2732882" style="color: black;">
<div class="gist-file" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(204, 204, 204); border-style: solid; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; font-family: Consolas, 'Liberation Mono', Courier, monospace; margin-bottom: 1em;">
<div class="gist-data gist-syntax" style="background-color: ghostwhite; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; overflow: auto; word-wrap: normal;">
<div class="file-data">
<table cellpadding="0" cellspacing="0" class="lines highlight"><tbody>
<tr><td class="line-numbers" style="background-color: #ececec; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; color: #aaaaaa; padding: 0.5em; text-align: right;"><span class="line-number" id="file-gistfile1-java-L1" rel="file-gistfile1-java-L1" style="clear: right; display: block;">1</span><span class="line-number" id="file-gistfile1-java-L2" rel="file-gistfile1-java-L2" style="clear: right; display: block;">2</span><span class="line-number" id="file-gistfile1-java-L3" rel="file-gistfile1-java-L3" style="clear: right; display: block;">3</span><span class="line-number" id="file-gistfile1-java-L4" rel="file-gistfile1-java-L4" style="clear: right; display: block;">4</span><span class="line-number" id="file-gistfile1-java-L5" rel="file-gistfile1-java-L5" style="clear: right; display: block;">5</span><span class="line-number" id="file-gistfile1-java-L6" rel="file-gistfile1-java-L6" style="clear: right; display: block;">6</span><span class="line-number" id="file-gistfile1-java-L7" rel="file-gistfile1-java-L7" style="clear: right; display: block;">7</span><span class="line-number" id="file-gistfile1-java-L8" rel="file-gistfile1-java-L8" style="clear: right; display: block;">8</span><span class="line-number" id="file-gistfile1-java-L9" rel="file-gistfile1-java-L9" style="clear: right; display: block;">9</span><span class="line-number" id="file-gistfile1-java-L10" rel="file-gistfile1-java-L10" style="clear: right; display: block;">10</span><span class="line-number" id="file-gistfile1-java-L11" rel="file-gistfile1-java-L11" style="clear: right; display: block;">11</span><span class="line-number" id="file-gistfile1-java-L12" rel="file-gistfile1-java-L12" style="clear: right; display: block;">12</span><span class="line-number" id="file-gistfile1-java-L13" rel="file-gistfile1-java-L13" style="clear: right; display: block;">13</span><span class="line-number" id="file-gistfile1-java-L14" rel="file-gistfile1-java-L14" style="clear: right; display: block;">14</span><span class="line-number" id="file-gistfile1-java-L15" rel="file-gistfile1-java-L15" style="clear: right; display: block;">15</span><span class="line-number" id="file-gistfile1-java-L16" rel="file-gistfile1-java-L16" style="clear: right; display: block;">16</span><span class="line-number" id="file-gistfile1-java-L17" rel="file-gistfile1-java-L17" style="clear: right; display: block;">17</span><span class="line-number" id="file-gistfile1-java-L18" rel="file-gistfile1-java-L18" style="clear: right; display: block;">18</span><span class="line-number" id="file-gistfile1-java-L19" rel="file-gistfile1-java-L19" style="clear: right; display: block;">19</span><span class="line-number" id="file-gistfile1-java-L20" rel="file-gistfile1-java-L20" style="clear: right; display: block;">20</span><span class="line-number" id="file-gistfile1-java-L21" rel="file-gistfile1-java-L21" style="clear: right; display: block;">21</span><span class="line-number" id="file-gistfile1-java-L22" rel="file-gistfile1-java-L22" style="clear: right; display: block;">22</span><span class="line-number" id="file-gistfile1-java-L23" rel="file-gistfile1-java-L23" style="clear: right; display: block;">23</span></td><td class="line-data" style="padding: 0.5em !important;"><pre class="line-pre" style="background-color: transparent !important; border: none !important; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; padding: 0px !important;"><div class="line" id="file-gistfile1-java-LC1">
<span class="err" style="background-color: #e3d2d2; color: #a61717;">#</span><span class="n">include</span> <span class="o" style="font-weight: bold;"><</span><span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">h</span><span class="o" style="font-weight: bold;">></span></div>
<div class="line" id="file-gistfile1-java-LC2">
</div>
<div class="line" id="file-gistfile1-java-LC3">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">setup</span><span class="o" style="font-weight: bold;">()</span></div>
<div class="line" id="file-gistfile1-java-LC4">
<span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-gistfile1-java-LC5">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">begin</span><span class="o" style="font-weight: bold;">();</span> </div>
<div class="line" id="file-gistfile1-java-LC6">
<span class="o" style="font-weight: bold;">}</span></div>
<div class="line" id="file-gistfile1-java-LC7">
</div>
<div class="line" id="file-gistfile1-java-LC8">
<span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">algo</span><span class="o" style="font-weight: bold;">;</span></div>
<div class="line" id="file-gistfile1-java-LC9">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">loop</span><span class="o" style="font-weight: bold;">()</span></div>
<div class="line" id="file-gistfile1-java-LC10">
<span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-gistfile1-java-LC11">
<span class="n">algo</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">HIGH</span><span class="o" style="font-weight: bold;">;</span></div>
<div class="line" id="file-gistfile1-java-LC12">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">beginTransmission</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">2</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC13">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">send</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">13</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC14">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">send</span><span class="o" style="font-weight: bold;">(</span><span class="n">algo</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC15">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">endTransmission</span><span class="o" style="font-weight: bold;">();</span></div>
<div class="line" id="file-gistfile1-java-LC16">
<span class="n">delay</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">500</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC17">
<span class="n">algo</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">LOW</span><span class="o" style="font-weight: bold;">;</span></div>
<div class="line" id="file-gistfile1-java-LC18">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">beginTransmission</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">2</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC19">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">send</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">13</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC20">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">send</span><span class="o" style="font-weight: bold;">(</span><span class="n">algo</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC21">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">endTransmission</span><span class="o" style="font-weight: bold;">();</span></div>
<div class="line" id="file-gistfile1-java-LC22">
<span class="n">delay</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">500</span><span class="o" style="font-weight: bold;">);</span></div>
<div class="line" id="file-gistfile1-java-LC23">
<span class="o" style="font-weight: bold;">}</span></div>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
<div class="gist-meta" style="background-color: #e8e8e8; background-image: linear-gradient(rgb(250, 250, 250), rgb(232, 232, 232)); background-repeat: repeat no-repeat; color: #999999; font-family: 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: normal; overflow: hidden; padding: 10px; text-shadow: rgba(255, 255, 255, 0.8) 1px 1px;">
<a href="https://gist.github.com/anonymous/2732882/raw/gistfile1.java" style="color: #666666; float: right; font-weight: bold; text-decoration: none;">view raw</a><a href="https://gist.github.com/anonymous/2732882#file-gistfile1-java" style="color: #666666; font-weight: bold; text-decoration: none;">gistfile1.java</a> hosted with ❤ by <a href="https://github.com/" style="color: #666666; font-weight: bold; text-decoration: none;">GitHub</a></div>
</div>
</div>
<br />
<br />
<br />
Y para el Arduino esclavo:<br />
<br />
<div class="gist" id="gist2732889" style="color: black;">
<div class="gist-file" style="border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(204, 204, 204); border-style: solid; border-top-left-radius: 3px; border-top-right-radius: 3px; border-width: 1px; font-family: Consolas, 'Liberation Mono', Courier, monospace; margin-bottom: 1em;">
<div class="gist-data gist-syntax" style="background-color: ghostwhite; border-bottom-color: rgb(221, 221, 221); border-bottom-style: solid; border-bottom-width: 1px; overflow: auto; word-wrap: normal;">
<div class="file-data">
<table cellpadding="0" cellspacing="0" class="lines highlight"><tbody>
<tr><td class="line-numbers" style="background-color: #ececec; border-right-color: rgb(221, 221, 221); border-right-style: solid; border-right-width: 1px; color: #aaaaaa; padding: 0.5em; text-align: right;"><span class="line-number" id="file-gistfile1-java-L1" rel="file-gistfile1-java-L1" style="clear: right; display: block;">1</span><span class="line-number" id="file-gistfile1-java-L2" rel="file-gistfile1-java-L2" style="clear: right; display: block;">2</span><span class="line-number" id="file-gistfile1-java-L3" rel="file-gistfile1-java-L3" style="clear: right; display: block;">3</span><span class="line-number" id="file-gistfile1-java-L4" rel="file-gistfile1-java-L4" style="clear: right; display: block;">4</span><span class="line-number" id="file-gistfile1-java-L5" rel="file-gistfile1-java-L5" style="clear: right; display: block;">5</span><span class="line-number" id="file-gistfile1-java-L6" rel="file-gistfile1-java-L6" style="clear: right; display: block;">6</span><span class="line-number" id="file-gistfile1-java-L7" rel="file-gistfile1-java-L7" style="clear: right; display: block;">7</span><span class="line-number" id="file-gistfile1-java-L8" rel="file-gistfile1-java-L8" style="clear: right; display: block;">8</span><span class="line-number" id="file-gistfile1-java-L9" rel="file-gistfile1-java-L9" style="clear: right; display: block;">9</span><span class="line-number" id="file-gistfile1-java-L10" rel="file-gistfile1-java-L10" style="clear: right; display: block;">10</span><span class="line-number" id="file-gistfile1-java-L11" rel="file-gistfile1-java-L11" style="clear: right; display: block;">11</span><span class="line-number" id="file-gistfile1-java-L12" rel="file-gistfile1-java-L12" style="clear: right; display: block;">12</span><span class="line-number" id="file-gistfile1-java-L13" rel="file-gistfile1-java-L13" style="clear: right; display: block;">13</span><span class="line-number" id="file-gistfile1-java-L14" rel="file-gistfile1-java-L14" style="clear: right; display: block;">14</span><span class="line-number" id="file-gistfile1-java-L15" rel="file-gistfile1-java-L15" style="clear: right; display: block;">15</span><span class="line-number" id="file-gistfile1-java-L16" rel="file-gistfile1-java-L16" style="clear: right; display: block;">16</span><span class="line-number" id="file-gistfile1-java-L17" rel="file-gistfile1-java-L17" style="clear: right; display: block;">17</span><span class="line-number" id="file-gistfile1-java-L18" rel="file-gistfile1-java-L18" style="clear: right; display: block;">18</span><span class="line-number" id="file-gistfile1-java-L19" rel="file-gistfile1-java-L19" style="clear: right; display: block;">19</span><span class="line-number" id="file-gistfile1-java-L20" rel="file-gistfile1-java-L20" style="clear: right; display: block;">20</span><span class="line-number" id="file-gistfile1-java-L21" rel="file-gistfile1-java-L21" style="clear: right; display: block;">21</span><span class="line-number" id="file-gistfile1-java-L22" rel="file-gistfile1-java-L22" style="clear: right; display: block;">22</span><span class="line-number" id="file-gistfile1-java-L23" rel="file-gistfile1-java-L23" style="clear: right; display: block;">23</span><span class="line-number" id="file-gistfile1-java-L24" rel="file-gistfile1-java-L24" style="clear: right; display: block;">24</span><span class="line-number" id="file-gistfile1-java-L25" rel="file-gistfile1-java-L25" style="clear: right; display: block;">25</span></td><td class="line-data" style="padding: 0.5em !important;"><pre class="line-pre" style="background-color: transparent !important; border: none !important; font-family: Consolas, 'Liberation Mono', Courier, monospace; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; padding: 0px !important;"><div class="line" id="file-gistfile1-java-LC1">
<span class="err" style="background-color: #e3d2d2; color: #a61717;">#</span><span class="n">include</span> <span class="o" style="font-weight: bold;"><</span><span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">h</span><span class="o" style="font-weight: bold;">></span></div>
<div class="line" id="file-gistfile1-java-LC2">
</div>
<div class="line" id="file-gistfile1-java-LC3">
<span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">pin</span><span class="o" style="font-weight: bold;">;</span></div>
<div class="line" id="file-gistfile1-java-LC4">
<span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">estado</span><span class="o" style="font-weight: bold;">;</span></div>
<div class="line" id="file-gistfile1-java-LC5">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">setup</span><span class="o" style="font-weight: bold;">()</span></div>
<div class="line" id="file-gistfile1-java-LC6">
<span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-gistfile1-java-LC7">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">begin</span><span class="o" style="font-weight: bold;">(</span><span class="mi" style="color: #009999;">2</span><span class="o" style="font-weight: bold;">);</span> </div>
<div class="line" id="file-gistfile1-java-LC8">
<span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">onReceive</span><span class="o" style="font-weight: bold;">(</span><span class="n">receiveEvent</span><span class="o" style="font-weight: bold;">);</span> </div>
<div class="line" id="file-gistfile1-java-LC9">
<span class="o" style="font-weight: bold;">}</span></div>
<div class="line" id="file-gistfile1-java-LC10">
</div>
<div class="line" id="file-gistfile1-java-LC11">
</div>
<div class="line" id="file-gistfile1-java-LC12">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">loop</span><span class="o" style="font-weight: bold;">()</span></div>
<div class="line" id="file-gistfile1-java-LC13">
<span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-gistfile1-java-LC14">
<span class="o" style="font-weight: bold;">}</span></div>
<div class="line" id="file-gistfile1-java-LC15">
</div>
<div class="line" id="file-gistfile1-java-LC16">
</div>
<div class="line" id="file-gistfile1-java-LC17">
</div>
<div class="line" id="file-gistfile1-java-LC18">
<span class="kt" style="color: #445588; font-weight: bold;">void</span> <span class="nf" style="color: #990000; font-weight: bold;">receiveEvent</span><span class="o" style="font-weight: bold;">(</span><span class="kt" style="color: #445588; font-weight: bold;">int</span> <span class="n">howMany</span><span class="o" style="font-weight: bold;">)</span></div>
<div class="line" id="file-gistfile1-java-LC19">
<span class="o" style="font-weight: bold;">{</span></div>
<div class="line" id="file-gistfile1-java-LC20">
<span class="n">pin</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">receive</span><span class="o" style="font-weight: bold;">();</span></div>
<div class="line" id="file-gistfile1-java-LC21">
<span class="n">estado</span> <span class="o" style="font-weight: bold;">=</span> <span class="n">Wire</span><span class="o" style="font-weight: bold;">.</span><span class="na" style="color: teal;">receive</span><span class="o" style="font-weight: bold;">();</span></div>
<div class="line" id="file-gistfile1-java-LC22">
<span class="n">digitalWrite</span><span class="o" style="font-weight: bold;">(</span><span class="n">pin</span><span class="o" style="font-weight: bold;">,</span> <span class="n">estado</span><span class="o" style="font-weight: bold;">);</span> </div>
<div class="line" id="file-gistfile1-java-LC23">
</div>
<div class="line" id="file-gistfile1-java-LC24">
</div>
<div class="line" id="file-gistfile1-java-LC25">
<span class="o" style="font-weight: bold;">}</span></div>
</pre>
</td></tr>
</tbody></table>
</div>
</div>
<div class="gist-meta" style="background-color: #e8e8e8; background-image: linear-gradient(rgb(250, 250, 250), rgb(232, 232, 232)); background-repeat: repeat no-repeat; color: #999999; font-family: 'Helvetica Neue', Helvetica, arial, freesans, clean, sans-serif; font-size: 12px; line-height: normal; overflow: hidden; padding: 10px; text-shadow: rgba(255, 255, 255, 0.8) 1px 1px;">
<a href="https://gist.github.com/anonymous/2732889/raw/gistfile1.java" style="color: #666666; float: right; font-weight: bold; text-decoration: none;">view raw</a><a href="https://gist.github.com/anonymous/2732889#file-gistfile1-java" style="color: #666666; font-weight: bold; text-decoration: none;">gistfile1.java</a> hosted with ❤ by <a href="https://github.com/" style="color: #666666; font-weight: bold; text-decoration: none;">GitHub</a></div>
</div>
</div>
<br />
<br />
<br />
Básicamente estamos diciendo en el programa master en el loop que escriba en el pin 13 del Arduino 2, y manda valores HIGH y LOW cada ciertos segundos para apagar y prender el led.<br />
En el programa esclavo, se recibe el evento y se escribe en la salida digital el estado y el pin que se mando en el master.<br />
Es muy fácil de hacer y bastante útil.<br />
<br />
Aquí un vídeo y fotos de como me quedo a mi:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiobKL4u2TxrQeu26FX_l0NKA3cYkyIImCd-T0JkDyEpD8KCtsOPis-yzem8v9jlBUqlYPac6Bk8JJe8Wkys9Zm2u1UQaEny5UoDoPJgdzGGWRcB2lByIoozkDo8ls3mgexFeK6GpgwSA8/s1600/DSCF1090.JPG" imageanchor="1" style="color: #4d469c; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiobKL4u2TxrQeu26FX_l0NKA3cYkyIImCd-T0JkDyEpD8KCtsOPis-yzem8v9jlBUqlYPac6Bk8JJe8Wkys9Zm2u1UQaEny5UoDoPJgdzGGWRcB2lByIoozkDo8ls3mgexFeK6GpgwSA8/s320/DSCF1090.JPG" height="237" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcLad8_jPZjQW3p6Xxrq6CijY6OXOn1jYN9_kud5JHFIgy0IPEj3s0Hc3fav1kgQGuZXiSfw0FlnqD4CzvnBLPENz31mY_uj0jpACL5zklJ3su7nbCV9qromiyz85ZNaFsoNPuTJjv5As/s1600/DSCF1090.JPG" imageanchor="1" style="color: #4d469c; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcLad8_jPZjQW3p6Xxrq6CijY6OXOn1jYN9_kud5JHFIgy0IPEj3s0Hc3fav1kgQGuZXiSfw0FlnqD4CzvnBLPENz31mY_uj0jpACL5zklJ3su7nbCV9qromiyz85ZNaFsoNPuTJjv5As/s320/DSCF1090.JPG" height="237" style="-webkit-box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; background-color: transparent; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border: 1px solid transparent; box-shadow: rgba(0, 0, 0, 0.2) 0px 0px 0px; padding: 8px; position: relative;" width="320" /></a></div>
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/zJCoZ_kZgs8" width="560"></iframe></div>
<br />
Fuentes:<br />
<a href="http://ramon-gzz.blogspot.com.es/2012/05/aumentar-pines-digitales-en-arduino-uno.html">http://ramon-gzz.blogspot.com.es/2012/05/aumentar-pines-digitales-en-arduino-uno.html</a><br />
<a href="http://cecilia-urbina.blogspot.mx/2012/05/otra-opcion-aumentar-io-arduino.html">http://cecilia-urbina.blogspot.mx/2012/05/otra-opcion-aumentar-io-arduino.html</a><br />
<br />
<br />jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-52642749452853687802013-06-28T06:34:00.002-07:002013-06-28T06:34:45.101-07:00Gambas y Arduino: Ejemplo 5 Medicion de distancia y decirla en voz alta<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<span style="font-size: large;">Gambas y Arduino</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<span style="font-size: large;"> Ejemplo 5</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<span style="font-size: large;"> Medir distancias y decirlas en voz alta</span></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Os dejo aqui otro ejemplo de </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> y arduino, esta vez usando un sensor de distancias (el HC-SR04).</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">El programa de arduino, lee la distancia y la escribe en el puerto </span><span class="IL_AD" id="IL_AD7" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">serial</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Lo que hago con </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> es leer la entrada del puerto serie y usar el comando espeak</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">para dictar la distancia.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Montaje:</span><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL9LNCZcPyyH5qvx48zJ8PvO1b6iion7-DH6iDOpyXmTc3a11TCbUxL5HtBvfpUSCKwU6600djUbDhOJVWKDUI7znBULjVDf1T4bMwygO9JxXAFNZG_00Ubn75nYfNPt_ZHLsfH1rFdC4/s1600/MONTAJE+HC-SR04+Y+ARDUINO.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL9LNCZcPyyH5qvx48zJ8PvO1b6iion7-DH6iDOpyXmTc3a11TCbUxL5HtBvfpUSCKwU6600djUbDhOJVWKDUI7znBULjVDf1T4bMwygO9JxXAFNZG_00Ubn75nYfNPt_ZHLsfH1rFdC4/s320/MONTAJE+HC-SR04+Y+ARDUINO.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="266" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Captura del programa funcionando:</span><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlXkb-2do7MHxX0bSn3gRMioN4P6hICtrNALlzEzGAvQ-TzfA-EJuu-O3nGb7G_ECly3Q8DlJ0Ok6JdPnYk3rErTuWJLvLgWJ-l9cQ3fAfqNK5Ftd0K0BzE4ChiNfUKLtca4h-OVSJOcA/s1600/Arduino++Gambas+dictador+de+distancias.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlXkb-2do7MHxX0bSn3gRMioN4P6hICtrNALlzEzGAvQ-TzfA-EJuu-O3nGb7G_ECly3Q8DlJ0Ok6JdPnYk3rErTuWJLvLgWJ-l9cQ3fAfqNK5Ftd0K0BzE4ChiNfUKLtca4h-OVSJOcA/s320/Arduino++Gambas+dictador+de+distancias.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Código para arduino:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">int</span> trigger<span style="color: navy;">=</span><span style="color: #0000dd;">11</span><span style="color: teal;">;</span> // Arduino pin tied to trigger pin on the <span class="IL_AD" id="IL_AD10" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">ultrasonic</span> sensor.</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">int</span> echo<span style="color: navy;">=</span> <span style="color: #0000dd;">12</span><span style="color: teal;">;</span> // Arduino pin tied to echo pin on the ultrasonic sensor.</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">float</span> distance<span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">int</span> val<span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">float</span> lim<span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">void</span> setup<span style="color: green;">()</span> <span style="color: green;">{</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #007788;">begin</span><span style="color: green;">(</span><span style="color: #0000dd;">9600</span><span style="color: green;">)</span><span style="color: teal;">;</span> // Open serial <span class="IL_AD" id="IL_AD4" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">monitor</span> at 9600 baud to see ping results.</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #202020;">pinMode</span><span style="color: green;">(</span>trigger<span style="color: #339933;">,</span>OUTPUT<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
pinMode<span style="color: green;">(</span>echo<span style="color: #339933;">,</span>INPUT<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: green;">}</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: blue;">void</span> loop<span style="color: green;">()</span> <span style="color: green;">{</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: green;">(</span>trigger<span style="color: #339933;">,</span>LOW<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
delayMicroseconds<span style="color: green;">(</span><span style="color: #0000dd;">5</span><span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: green;">(</span>trigger<span style="color: #339933;">,</span>HIGH<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
delayMicroseconds<span style="color: green;">(</span><span style="color: #0000dd;">10</span><span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: green;">(</span>trigger<span style="color: #339933;">,</span>LOW<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
distance<span style="color: navy;">=</span>pulseIn<span style="color: green;">(</span>echo<span style="color: #339933;">,</span>HIGH<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
distance<span style="color: navy;">=</span>distance<span style="color: #000040;">*</span><span style="color: #0000dd;">0.0001657</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
// Serial.println("Distancia:");</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #007788;">println</span><span style="color: green;">(</span>distance<span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
delay<span style="color: green;">(</span><span style="color: #0000dd;">200</span><span style="color: green;">)</span><span style="color: teal;">;</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: green;">}</span></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">El programa en </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' Gambas class file</i></span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span class="IL_AD" id="IL_AD12" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Public</span></span> valor <span style="color: #ff8000;">As</span> <span style="color: red;"><span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Integer</span></span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> encendido <span style="color: #ff8000;">As</span> <span style="color: red;"><span class="IL_AD" id="IL_AD11" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Boolean</span></span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Form_Close()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> Sport.<span style="color: blue;">Status</span> <span style="color: green;">=</span> Net.<span style="color: blue;">Active</span> <span style="color: #ff8000;">Then</span> <span style="color: #0600ff;">Close</span> Sport</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Button1_Click()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> Sport.<span style="color: blue;">Status</span> <span style="color: green;">=</span> Net.<span style="color: blue;">Active</span> <span style="color: #ff8000;">Then</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Close</span> Sport</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Button1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Abrir"</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Else</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' Line parameters</i></span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">PortName</span> <span style="color: green;">=</span> TxtPort.<span style="color: blue;">Text</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Speed</span> <span style="color: green;">=</span> CmbSpeed.<span style="color: blue;">Text</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Parity</span> <span style="color: green;">=</span> CmbParity.<span style="color: blue;">Index</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">DataBits</span> <span style="color: green;">=</span> CmbData.<span style="color: blue;">Text</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">StopBits</span> <span style="color: green;">=</span> CmbStop.<span style="color: blue;">Text</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' keep DTR on</i></span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">FlowControl</span> <span style="color: green;">=</span> ComboBox1.<span style="color: blue;">Index</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Open</span>()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
TextArea1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Port Abierto : "</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">PortName</span> <span style="color: green;">&</span> <span style="color: grey;">" Settings : "</span> <span style="color: green;">&</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Speed</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">Parity</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">DataBits</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">StopBits</span> <span style="color: green;">&</span> <span style="color: #0600ff;">Chr</span>(<span style="color: red;">13</span>) <span style="color: green;">&</span> <span style="color: #0600ff;">Chr</span>(<span style="color: red;">10</span>)</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Button1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Cerrar"</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span> <span style="color: #0600ff;">If</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Catch</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Message.<span style="color: blue;">Info</span>(<span style="color: grey;">"Error:"</span> <span style="color: green;">&</span> <span style="color: #ff8000;">Error</span>.<span style="color: blue;">text</span>)</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> SPort_Read()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Dim</span> valor <span style="color: #ff8000;">As</span> <span style="color: red;">Integer</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Dim</span> cadenas <span style="color: #ff8000;">As</span> <span style="color: #ff8000;">String</span>[]</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Dim</span> cadena <span style="color: #ff8000;">As</span> <span style="color: #ff8000;">String</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Dim</span> s <span style="color: #ff8000;">As</span> <span style="color: #ff8000;">String</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Read #Sport, s, <span style="color: #0600ff;">Lof</span>(Sport)</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> s <> <span style="color: grey;">""</span> <span style="color: #ff8000;">Then</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
cadenas <span style="color: green;">=</span> <span style="color: #0600ff;">Split</span>(s, <span style="color: grey;">"\n\r"</span>)</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Print</span> cadenas[cadenas.<span style="color: blue;">count</span> <span style="color: green;">-</span> <span style="color: red;">1</span>]</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
valor <span style="color: green;">=</span> cadenas.<span style="color: blue;">count</span> <span style="color: green;">-</span> <span style="color: red;">1</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">While</span> cadenas[valor] <span style="color: green;">=</span> <span style="color: grey;">""</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
valor <span style="color: green;">=</span> valor <span style="color: green;">-</span> <span style="color: red;">1</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Wend</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
cadena <span style="color: green;">=</span> <span style="color: grey;">"\"</span>Distancia es <span style="color: grey;">" & cadenas[valor] & "</span><span style="color: green;">\</span><span style="color: grey;">""</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
LabelDistancia.<span style="color: blue;">text</span> <span style="color: green;">=</span> cadena</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Exec [<span style="color: grey;">"espeak"</span>, <span style="color: grey;">"-v"</span>, <span style="color: grey;">"es"</span>, cadena]</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Wait <span style="color: red;">3</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Endif</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> ComboBox1_Click()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">FlowControl</span> <span style="color: green;">=</span> ComboBox1.<span style="color: blue;">Index</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Form_Open()</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Me</span>.<span style="color: blue;">Caption</span> <span style="color: green;">=</span> <span style="color: grey;">"Medidor de distancia por Arduino"</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Me</span>.<span style="color: blue;">center</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
cmbSpeed.<span style="color: blue;">Index</span> <span style="color: green;">=</span> cmbSpeed.<span style="color: blue;">Find</span>(<span style="color: grey;">"9600"</span>)</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ComboBox1.<span style="color: blue;">Index</span> <span style="color: green;">=</span> <span style="color: red;">0</span></div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: #e6e6ff; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Enlace de descarga del código:</span><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://www.box.com/s/6ya9uzodkz7fw2muepgy" style="color: blue; text-decoration: none;">código en gambas3.4</a></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://www.box.com/s/s6shbnzioqg7igfq1l6c" style="color: blue; text-decoration: none;">codigo de arduino</a></div>
<div>
<br /></div>
jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-63513466606098187152013-06-28T06:33:00.003-07:002013-06-28T06:33:54.564-07:00Arduino y Gambas: Ejemplo 4: Usando Pulsadores<h2 style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 11px; margin: 0px 0px 1em; position: relative; text-align: center; text-transform: uppercase;">
ARDUINO Y GAMBAS</h2>
<h2 style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 11px; margin: 0px 0px 1em; position: relative; text-align: center; text-transform: uppercase;">
EJEMPLO 4</h2>
<h2 style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 11px; margin: 0px 0px 1em; position: relative; text-align: center; text-transform: uppercase;">
USANDO PULSADORES</h2>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Aquí os dejo un ejemplo, que me ha pedido </span><a href="http://www.youtube.com/channel/UCUjvZIT09HLC47JYp0oOMdw?feature=em-comment_received" style="background-color: white; color: #1c62b9; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Diego carpio </a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Se trata de usar dos pulsadores, conectados al arduino y que con </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">mostremos en el </span><span class="IL_AD" id="IL_AD7" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">monitor</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> del pc, cual de ellos se ha pulsado.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> </span><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
Circuito de los dos pulsadores:</div>
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5kKC47DCsOvtjP-WEopIMoftDyBWJBP4TOxiAT_1DoZQJ6tQpOVKCLa2aco_1O5Nxi3bE6xTMf_LqxgFi-cWIG07E04z_ybzr1Vo8hyIbKaahpwoOGEA9Pnz8IgQTFolGLQid9gW8kNw/s1600/esquema+de+montaje+de+los+dos+pulsadores+y+arduino.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5kKC47DCsOvtjP-WEopIMoftDyBWJBP4TOxiAT_1DoZQJ6tQpOVKCLa2aco_1O5Nxi3bE6xTMf_LqxgFi-cWIG07E04z_ybzr1Vo8hyIbKaahpwoOGEA9Pnz8IgQTFolGLQid9gW8kNw/s320/esquema+de+montaje+de+los+dos+pulsadores+y+arduino.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">En </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> creo un </span><span class="IL_AD" id="IL_AD8" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">formulario</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> con los </span><span class="IL_AD" id="IL_AD6" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">combobox</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> de las caracteristicas de la conexión </span><span class="IL_AD" id="IL_AD10" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">serial</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> (en principio hay que dejarlos igual como aparecen en la captura) y pongo dos ToggleButton que van a cambiar de color según el pulsador de la protoboard de arduino que se pulse.</span><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
Aqui os dejo una captura del programa en funcionamiento:</div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_RrbLEqsPXFV5QLMK4EIwipMPMrprYU8tOPzXn_R1uGTZYrqg8CwgZFHDTGFHUws7ujNqZyWoHO3xckGoSu2icn3km3gjSa5Oe9JD12iSE11s0HWCmPxSXXw2TbK79yvKchZTan3M4PU/s1600/arduino+gambas+programa+para+dos+pulsadores.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="296" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_RrbLEqsPXFV5QLMK4EIwipMPMrprYU8tOPzXn_R1uGTZYrqg8CwgZFHDTGFHUws7ujNqZyWoHO3xckGoSu2icn3km3gjSa5Oe9JD12iSE11s0HWCmPxSXXw2TbK79yvKchZTan3M4PU/s320/arduino+gambas+programa+para+dos+pulsadores.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Como siempre son 2 programas, uno que debemos grabar en el arduino y otro el de </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> (realizado en la version de gambas3.4.1)</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><u style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"><i><b>1º Para el arduino:</b></i></u><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">int</span> dato1<span style="color: #339933;">;</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">int</span> dato2<span style="color: #339933;">;</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">int</span> inPin1<span style="color: #339933;">=</span><span style="color: #0000dd;">8</span><span style="color: #339933;">;</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">int</span> inPin2<span style="color: #339933;">=</span><span style="color: #0000dd;">9</span><span style="color: #339933;">;</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">void</span> setup<span style="color: #339933;">()</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">{</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #6aa84f;">// Inicializamos puerto serie a 9600 bps</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">begin</span><span style="color: #339933;">(</span><span style="color: #0000dd;">9600</span><span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
pinMode<span style="color: #339933;">(</span>inPin1<span style="color: #339933;">,</span>INPUT<span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
pinMode<span style="color: #339933;">(</span>inPin2<span style="color: #339933;">,</span>INPUT<span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">/<span style="color: #6aa84f;">/</span></span><span style="color: #6aa84f;"> Enviamos "Hello World" con salto de línea al final</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: red;">"Conectado con el Arduino. Hello world!"</span><span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #6aa84f;">//arduino manda esta cadena al PC</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #993333;">void</span> loop<span style="color: #339933;">()</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">{</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
dato1<span style="color: #339933;">=</span>digitalRead<span style="color: #339933;">(</span>inPin1<span style="color: #339933;">); // lee datos del pin nº 8</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
dato2<span style="color: #339933;">=</span>digitalRead<span style="color: #339933;">(</span>inPin2<span style="color: #339933;">); // lee datos del pin nº 9</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #b1b100;">if</span> <span style="color: #339933;">(</span>dato1<span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #339933;">)</span> <span style="color: #339933;">{</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: #0000dd;">1</span><span style="color: #339933;">); // escribo en el puerto serie el numero 1</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">); // enciendo el led del arduino</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
delay<span style="color: #339933;">(</span><span style="color: #0000dd;">450</span><span style="color: #339933;">); //espero casi medio segundo</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">); //apago el led de arduino</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #b1b100;">if</span> <span style="color: #339933;">(</span>dato2<span style="color: #339933;">==</span><span style="color: #0000dd;">1</span><span style="color: #339933;">)</span> <span style="color: #339933;">{</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: #0000dd;">2</span><span style="color: #339933;">); // escribo en el puerto serie el numero 2</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
delay<span style="color: #339933;">(</span><span style="color: #0000dd;">450</span><span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">);</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<u><i><b><br /></b></i></u></div>
<u style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"><i><b></b></i></u><u style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"><i><b>2º El programa de Gambas3:</b></i></u><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' Gambas class file</i></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> valor <span style="color: #ff8000;">As</span> <span style="color: red;"><span class="IL_AD" id="IL_AD3" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Integer</span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> encendido <span style="color: #ff8000;">As</span> <span style="color: red;">Boolean</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Form_Close()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> Sport.<span style="color: blue;">Status</span> <span style="color: green;">=</span> Net.<span style="color: blue;">Active</span> <span style="color: #ff8000;">Then</span> <span style="color: #0600ff;">Close</span> Sport</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Button1_Click()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> Sport.<span style="color: blue;">Status</span> <span style="color: green;">=</span> Net.<span style="color: blue;">Active</span> <span style="color: #ff8000;">Then</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Close</span> Sport</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Button1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Abrir"</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Else</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' Line parameters</i></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">PortName</span> <span style="color: green;">=</span> TxtPort.<span style="color: blue;">Text</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Speed</span> <span style="color: green;">=</span> CmbSpeed.<span style="color: blue;">Text</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Parity</span> <span style="color: green;">=</span> CmbParity.<span style="color: blue;">Index</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">DataBits</span> <span style="color: green;">=</span> CmbData.<span style="color: blue;">Text</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">StopBits</span> <span style="color: green;">=</span> CmbStop.<span style="color: blue;">Text</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: teal;"><i>' keep DTR on</i></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">FlowControl</span> <span style="color: green;">=</span> ComboBox1.<span style="color: blue;">Index</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Open</span>()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
TextArea1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Port Abierto : "</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">PortName</span> <span style="color: green;">&</span> <span style="color: grey;">" Settings : "</span> <span style="color: green;">&</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">Speed</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">Parity</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span> Sport.<span style="color: blue;">DataBits</span> <span style="color: green;">&</span> <span style="color: grey;">","</span> <span style="color: green;">&</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">StopBits</span> <span style="color: green;">&</span> <span style="color: #0600ff;">Chr</span>(<span style="color: red;">13</span>) <span style="color: green;">&</span> <span style="color: #0600ff;">Chr</span>(<span style="color: red;">10</span>)</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Button1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> <span style="color: grey;">"Cerrar"</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span> <span style="color: #0600ff;">If</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Catch</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Message.<span style="color: blue;">Info</span>(<span style="color: grey;">"Error:"</span> <span style="color: green;">&</span> <span style="color: #ff8000;">Error</span>.<span style="color: blue;">text</span>)</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> SPort_Read()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">Dim</span> s <span style="color: #ff8000;">As</span> <span style="color: #ff8000;">String</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Read #Sport, s, <span style="color: #0600ff;">Lof</span>(Sport)</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
TextArea1.<span style="color: blue;">Text</span> <span style="color: green;">=</span> s <span style="color: teal;"><i>'TextArea1.Text & s</i></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> IsNumber(s) <span style="color: #ff8000;">Then</span> valor <span style="color: green;">=</span> <span style="color: #0600ff;">Val</span>(s)</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> valor <span style="color: green;">=</span> <span style="color: red;">1</span> <span style="color: #ff8000;">Then</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #6aa84f;">'recibo el numero 1, cambio de color el <span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">boton</span> </span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton1.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">red</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Wait <span style="color: red;">0.4</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton1.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">Gray</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Endif</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">If</span> valor <span style="color: green;">=</span> <span style="color: red;">2</span> <span style="color: #ff8000;">Then</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #6aa84f;">'recibo el numero 2, cambio de color el boton </span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton2.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">green</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Wait <span style="color: red;">0.4</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton2.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">Gray</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Endif</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> ComboBox1_Click()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
Sport.<span style="color: blue;">FlowControl</span> <span style="color: green;">=</span> ComboBox1.<span style="color: blue;">Index</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Public</span> <span style="color: #0600ff;">Sub</span> Form_Open()</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #ff8000;">Me</span>.<span style="color: blue;">center</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
cmbSpeed.<span style="color: blue;">Index</span> <span style="color: green;">=</span> cmbSpeed.<span style="color: blue;">Find</span>(<span style="color: grey;">"9600"</span>)</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ComboBox1.<span style="color: blue;">Index</span> <span style="color: green;">=</span> <span style="color: red;">0</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton2.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">Gray</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
ToggleButton1.<span style="color: blue;">Background</span> <span style="color: green;">=</span> Color.<span style="color: blue;">Gray</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;">End</span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: #0600ff;"><span style="color: black;">Os dejo aquí los enlaces de descarga de los programas....</span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Enlace de descarga del programa de arduino: </span><a href="https://www.box.com/s/erda06gc418y5rqcdnpc" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;">enlace</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Enlace de descarga del programa en gambas3.4: </span><a href="https://www.box.com/s/l4t4yiq9vvzw7hf2iana" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;">enlace</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Para ver más ejemplos de pulsadores en Arduino:</span><a href="http://www.hispavila.com/3ds/atmega/pulsadores.html" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;">http://www.hispavila.com/3ds/atmega/pulsadores.html</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-12489637735794110142013-06-28T06:33:00.000-07:002013-06-28T06:33:05.458-07:00Gambas Y Arduino: 3º Ejemplo Moviendo dos Servomotores<br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPDoekCWtM055JV0w7tg7KfA2L37i_9VUMqTT8MzZGp-4wmQAhpwaaTxVwYrRZkC3-3qSv-j5IRX3u7h7JtpEBOCI56pTN2en8c7fmpsjE3_3hFJ0FDbAgkBH_e9-zux6wpuewW6ivbFCR/s1600/gambas+logotipo+ganador+update.png" imageanchor="1" style="clear: left; color: blue; float: left; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPDoekCWtM055JV0w7tg7KfA2L37i_9VUMqTT8MzZGp-4wmQAhpwaaTxVwYrRZkC3-3qSv-j5IRX3u7h7JtpEBOCI56pTN2en8c7fmpsjE3_3hFJ0FDbAgkBH_e9-zux6wpuewW6ivbFCR/s200/gambas+logotipo+ganador+update.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="134" /></a></div>
<h3 style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; margin: 0px; position: relative;">
<div style="text-align: center;">
<br /></div>
<b><div style="text-align: center;">
<b>Gambas Y Arduino:</b></div>
</b><b><div style="text-align: center;">
<b>3º Ejemplo</b></div>
</b><b><div style="text-align: center;">
<b>Moviendo dos Servomotores</b></div>
</b></h3>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<br /></div>
<span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">En el ejemplo anterior ( </span><a href="http://jsbsan.blogspot.com.es/2012/05/arduino-y-gambas3-lectura-y-graficos-de.html" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">lectura y graficos de datos de arduino con gambas</a><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">), vimos como </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> podía reconocer una trama de datos que enviaba </span><span class="IL_AD" id="IL_AD9" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, y se encargaba de mostrarlos en una gráfica.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Esta vez, vamos a hacer el paso contrario: Pasar "ordenes" desde </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> a </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, y que este las interprete y ejecute lo que le estemos diciendo (mueva el </span><span class="IL_AD" id="IL_AD1" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">motor</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> indicado una serie de grados).</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Para ello la tramo de datos, (protocolo) es la siguiente:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">12333</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">siendo:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">1: Letra que indica cual dispositivo es sobre hay que actuar. Usamos la "M" para indicar servomotor</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">2: Numero que indica cual de los dispositivos vamos a </span><span class="IL_AD" id="IL_AD6" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">mover</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">. (si hay varios servomotores, el 0, sera el primero, el 1 será el segundo... etc, el limite son 10 (de 0 a 9)</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">333: Indica los grados que se van a girar los servomotores.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Por ejemplo, si le mandamos desde </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> a </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> este comando:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">M0180 -> Girara, el servomotor (M), nº 0, 180º grados.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">M190 -> Girará, el servomotor (M), nº 1, 90 º grados.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Para facilitar al usuario, esta labor, lo que hacemos es usar unos botones gráficos tipo "DIAL"</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://www.zimagez.com/miniature/capturadepantalla-180512-200100.php" imageanchor="1" style="background-color: white; clear: left; color: blue; float: left; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="http://www.zimagez.com/miniature/capturadepantalla-180512-200100.php" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" /></a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">y el programa en </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, crea y manda las ordenes a </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, que se encarga de leer la orden, interpretarla y ejecutarla.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Aqui teneis el montaje:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://www.zimagez.com/zimage/capturadepantalla-180512-202113.php" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;"><img src="http://www.zimagez.com/miniature/capturadepantalla-180512-202113.php" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" /> </a><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"></span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Nota: </b><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">se usan los puertos digitales (PWM) para conectar los servomotores con</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">. Es importante no usar el pin nº 0 ni el pin nº 1, ya que ambos se usan para la comunicación en Serie-USB con el ordenador.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Aqui teneis el código del programa en </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<table cellpadding="4" cellspacing="0" style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"><colgroup><col width="256*"></col></colgroup><tbody>
<tr><td style="border: 1px solid rgb(0, 0, 0); padding: 0.1cm;" valign="TOP" width="100%"><div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">' Gambas class file</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">As</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">New</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">SerialPort</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">As</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Boolean</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">As</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">String</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">_new</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Form_Open</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Me</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Center</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">False</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy; font-family: 'Courier New', serif;">End</span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">ToolButton1_Click</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">If</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">False</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Then</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">If</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Status</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Net</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Active</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Then</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Close</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Sport</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Else</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">PortName</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"/dev/ttyUSB0"</span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'esto puede cambiar segun al puerto al que conectes tu arduino</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">speed</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">9600</span></span> </div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'tiene que ser la misma velocidad que tenga el programa de arduino.</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Parity</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">SerialPort</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">None</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">DataBits</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">SerialPort</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Bits8</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">StopBits</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">SerialPort</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Bits1</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">FlowControl</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">SerialPort</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">None</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Try</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.Open()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">If</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Error</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Then</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Message</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.Error(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Error al intentar conectar con puerto: "</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">PortName</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">False</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Else</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'le mando el comando "S" para que me conteste con los sensores que me va a devolver...</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Try</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">#</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">,</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"S"</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">If</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Error</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Then</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Message</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.Error(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Error al intentar enviar datos..."</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"No he podido conectarme"</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">False</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Else</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"ok...Conectado"</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">ToolButton1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;"><span class="IL_AD" id="IL_AD8" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">picture</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Picture</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"icon:/16/stop"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">True</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"M00"</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Endif</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'creo las clases para graficar los datos que voy a recibir</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Endif</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Endif</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Else</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">conectado</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">False</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">ToolButton1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">picture</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Picture</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"icon:/16/play"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Close</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">Sport</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Endif</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo1_Change</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">value</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'mortor 0, lo giro lo que indique el LCDNumber1</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"M0"</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Str$(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo2_Change</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">value</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'mortor 1, lo giro lo que indique el LCDNumber1</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"M1"</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Str$(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo3_Change</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">value</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">value</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">DialServo2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">value</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">'mortor 1, lo giro lo que indique el LCDNumber1</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"M0"</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Str$(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Wait</span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">0.1</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"M1"</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Str$(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">LCDNumber3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Value</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Public</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Sub</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">EscribeEnArduino</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">As</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">String)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Try</span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">#</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">sport</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">,</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">mensaje</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">If</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Error</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Then</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Message</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.Error(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Error al intentar enviar datos..."</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">"No he podido conectarme"</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Endif</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">Print</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">MENSAJE</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">End</span></span></span></td></tr>
</tbody></table>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<br /></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Y el código de </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<table cellpadding="4" cellspacing="0" style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"><colgroup><col width="256*"></col></colgroup><tbody>
<tr><td style="border: 1px solid rgb(0, 0, 0); padding: 0.1cm;" valign="TOP" width="100%"><div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">#include</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">h</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">></span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">const</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">TotalServos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// indico el numero de servos que tengo conectados</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Servo</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">TotalServos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">];</span></span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//defino un array de N elementos de instancia de la clase Servo</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">pos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">TotalServos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">];</span></span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// guarda posicion de los servos</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">byte</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">a</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// contador</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">void</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">setup</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">begin</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">9600</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Arduino conectado..."</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">" a la espera de ordenes"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// Definos los pin donde ira conectado cada servo: TotalServos</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">].</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">attach</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">2</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);//</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">el</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span> <span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">,</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">le</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">asigno</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">el</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">pin</span></span> 2<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">al</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">,</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">le</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">asigno</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">el</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">pin</span></span> 3<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">,....</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">].</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">attach</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">3</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">void</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">loop</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//Formato de orden de reconozco:</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//M0180</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//M=Motor</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//0=Nº del motor (si recibo N entoces son todos los<span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">motores</span>)</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">//180= grados de giro..</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span> <span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// leo</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">byte</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">contador</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">available</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">())</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">read</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">();</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Recibido: "</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">==</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">83</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Recibido S"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">==</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">77</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// entrada de orden de motor</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Recibido M"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">read</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">();</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">vermotor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// entrada para <span class="IL_AD" id="IL_AD10" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">ampliar</span> a otras ordenes</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// … (para añadir mas sensores... por ejemplo)</span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">void</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">vermotor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// convierto el caracter en numero (que indicara el servo a mover)</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">==</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">78</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Recibido N"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">print</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Todos los motores los muevos grados: "</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">recibirnumero</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">();</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// coloco a los servos al valor que me han pasado...</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">for</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">TotalServos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">-</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">1</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">++)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">pos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Servo ("</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"): "</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">b</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">].</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">write</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">((</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">>=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">48</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">&&</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">57</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">))</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"escribo en motor"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">movermotor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">recibirnumero</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">boolean</span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">entrada</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=true;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">char</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">cadena</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">24</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">];</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">n</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">a</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">while</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">available</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">()></span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: #4c4c4c;"><span style="font-family: 'Courier New', serif;">// delay(5);</span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">cadena</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">a</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">read</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">();</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">a</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">++;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">cadena</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">a</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">'\0'</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"En letra :"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">cadena</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">n</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">atoi</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">cadena</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"En numero :"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">n</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">return</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">n</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">}</span></span></span></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">void</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">movermotor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">){</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">int</span></span></span> <span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">print</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Muevo el motor ("</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">print</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">-</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">48</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">print</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"): "</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">recibirnumero</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">();</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"valor: "</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">pos</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">-</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">48</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">]=</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">servo</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">[</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">-</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">48</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">].</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">write</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">valor</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">delay</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">150</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">=</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">0</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">;</span></span></span></div>
<div style="margin-bottom: 0cm;">
<span style="color: navy; font-family: 'Courier New', serif;">}</span></div>
</td></tr>
</tbody></table>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Como veis tiene varias subrutinas (vermotor, movermotor y recibirnumero), que ayudan a que sea más claro el programa.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Lo que me costó más trabajo, fue la lectura de las ordenes del puerto serie, ya que </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> lee caracteres, o mejor dicho la conversión a ASCII de ellos, por eso cuando analizo la orden, no analizo caracteres sino números:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><br class="Apple-interchange-newline" />if</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">dato</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">==</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">78</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">)</span></span></span> <span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">{</span></span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: green;"><span style="font-family: 'Courier New', serif;">Serial</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">.</span></span></span><span style="color: green;"><span style="font-family: 'Courier New', serif;">println</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">(</span></span></span><span style="color: red;"><span style="font-family: 'Courier New', serif;">"Recibido N"</span></span><span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">);</span></span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><br /></span></span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx">N en ASCII es el nº 78,</span></span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><br /></span></span></span></div>
<div style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; margin-bottom: 0cm;">
<span style="color: navy;"><span style="font-family: 'Courier New', serif;"><span lang="zxx"><br /></span></span></span></div>
<span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Además teneia que "unir" los caracteres que formaban el nº que indica los grados a girar, eso lo solucioné usando un array del tipo </span><span class="IL_AD" id="IL_AD7" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Char</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, como podeis ver en el código de la subrutina recibirnumero.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Os dejo un video donde muestro como se usa el programa:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
</div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Os dejo los enlaces de descarga del cógido fuente de los dos programas, ya que el "copiar y pegar" os puede dar muchos problemas.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Códigos fuentes:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> </span><a href="http://fec73ee3.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">DosServoMotores.pde</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://34873fcf.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">ControlServos.tar.gz </a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">¿donde compre los servomotores y los cables?</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://b732e366.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">dealextreme.com</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-68955075028674326342013-06-28T06:29:00.001-07:002013-06-28T06:29:10.197-07:00Arduino y Gambas3: Lectura y Gráficos de datos de Sensores<br />
<h3 style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; margin: 0px; position: relative;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jvh_YsvRI78W6F1you7NGXX9QGGVWZeb6hJNmn_oNOjPp88vuSmJPNv2k40_h4u3vl5YHvRY9byb9pUA4uXt9MAFwV2Y2x0fdVy9BnVcmyyEDIN2G5vF3M1ixJPPVF6UFgPTc_MR4ihq/s1600/arduino+y+gambas3+sensores+graficos.png" imageanchor="1" style="clear: left; color: blue; float: left; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jvh_YsvRI78W6F1you7NGXX9QGGVWZeb6hJNmn_oNOjPp88vuSmJPNv2k40_h4u3vl5YHvRY9byb9pUA4uXt9MAFwV2Y2x0fdVy9BnVcmyyEDIN2G5vF3M1ixJPPVF6UFgPTc_MR4ihq/s200/arduino+y+gambas3+sensores+graficos.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="200" /></a>Gambas3 y Arduino:<br />2º ejemplo, lectura y gráficos de datos de sensores</h3>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Os dejo aqui un nuevo ejemplo de uso de Gambas3 y </span><span class="IL_AD" id="IL_AD7" style="background-attachment: scroll !important; background-color: white; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Esta vez se trata de mostrar y graficar datos que nos envia </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> de dos sensores:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">- Un LDR (fotoresistencia)</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">- Un medidor de temperatura DS1820.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Esta es una vista del programa:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYNAftYw82pgUg6xaC5l6yQ7fE6Pvv9vY2mgVGixStbnatA56F-R_cRovTdWa1sLBGhegJ7o74lofJElLg1efT5T-KlG4NVdDp3e0ELnfkGFfxe0D_lDR74XQZHKen-DVnbgrawv8lGhd6/s1600/ejemplogambasyarduino2.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYNAftYw82pgUg6xaC5l6yQ7fE6Pvv9vY2mgVGixStbnatA56F-R_cRovTdWa1sLBGhegJ7o74lofJElLg1efT5T-KlG4NVdDp3e0ELnfkGFfxe0D_lDR74XQZHKen-DVnbgrawv8lGhd6/s320/ejemplogambasyarduino2.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Un detalle del circuito:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgazIdpoybbtaB1c_S-kULssqdUpr9ubar0ggETtMQ722IB0-ALKFZdl6TLSjFQNiYIAj3SiZx-_WJiSoE7AT3P2USfv0qJusBbzIKf2d39WcTiOjlxDDrKcI6CzX0SQ045OO7sd8GB2Pg6/s1600/Esquema+Fritzing+Arduinom+LDR+DS1820.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgazIdpoybbtaB1c_S-kULssqdUpr9ubar0ggETtMQ722IB0-ALKFZdl6TLSjFQNiYIAj3SiZx-_WJiSoE7AT3P2USfv0qJusBbzIKf2d39WcTiOjlxDDrKcI6CzX0SQ045OO7sd8GB2Pg6/s320/Esquema+Fritzing+Arduinom+LDR+DS1820.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Un video donde podeis ver como actua:</span><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
</div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">El montaje "casero" en una protoboard:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br />
<div class="separator" style="background-color: white; clear: both; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibZefwWaa_D-36XNQNS7ykH5n0BZk9woK_DU2Fp9yKy81zyEP6_G3I9yK-lLvqLc3oQPH63LRwdPQ6vWJO41aWBV07hNhaLaFBIolktk9PVXoyZXx4dYX2bo8ZxpbY9_n-t9oxWs52DT4N/s1600/IMAG0070.jpg" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibZefwWaa_D-36XNQNS7ykH5n0BZk9woK_DU2Fp9yKy81zyEP6_G3I9yK-lLvqLc3oQPH63LRwdPQ6vWJO41aWBV07hNhaLaFBIolktk9PVXoyZXx4dYX2bo8ZxpbY9_n-t9oxWs52DT4N/s320/IMAG0070.jpg" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Basicamente lo que hacemos es:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">1) Un programa en el </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">arduino</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> va mandando al puerto serie, la información de dos sensores, uno de temperatura DS1820 y otro de iluminación ( una resistencia LDR), mediante una trama de datos como la que sigue "xxxAyyyyF"</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">La trama tiene este significado:</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> xxx: nombre del sensor</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> yyyy: valor numerico</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> A: caracter separador entre nombre del sensor y dato numerio</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"> F: indica fin de la linea de datos.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">2) El programa en </span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">gambas</span><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">, va leyendo el puerto serie, caracter por caracter, formando la cadena "xxxAyyyy"</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Cuando encuentra el caracter "F", analiza la cadena, y segun sea el sensor, modifica los valores del valuebox o de la barra de proceso, y además dibuja el dato en la gráfica.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Los programas son fácilmente ampliables a más sensores.</span><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Codigos fuentes:</b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://5d346c06.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Programa en Gambas3 (<span style="color: red;">Nueva versión 2</span>)</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://21854995.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Progama .pde para arduino</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">¿donde comprar el material? Por ejemplo en...</b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;"></b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://a83c9550.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">TaydaElectronics: ldr</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://ea58e376.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Taydaelectronics: DS1820 </a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://1ffe2a12.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Taydaelectronics: 220 resistencias</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Fuentes:</b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://62dcb11c.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">Proyectos-Arduino sensores-de-temperatura-ds18x20</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><a href="http://dfef82a6.linkbucks.com/" style="background-color: white; color: blue; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px; text-decoration: none;" target="_blank">SensorDeLuzLDR</a><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Nota:</b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><b style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">5/Mayor/2012: </b><br style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;" /><span style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 16.363636016845703px;">Se ha incluido una nueva versión del programa en Gambas3, relacionada con los gráficos</span>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-4534743622929782562013-06-28T06:27:00.001-07:002013-06-28T06:27:58.954-07:00Mi primera aplicacion con Gambas y Arduino<h3 class="post-title entry-title" itemprop="name" style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 22px; font-weight: normal; margin: 0.75em 0px 0px; position: relative;">
Mi primera aplicacion con Gambas y Arduino</h3>
<div class="post-header" style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 10.909090995788574px; line-height: 1.6; margin: 0px 0px 1.5em;">
<div class="post-header-line-1">
</div>
</div>
<div class="post-body entry-content" id="post-body-1661740371033859032" itemprop="articleBody" style="background-color: white; color: #666666; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 13.63636302947998px; line-height: 1.4; position: relative; width: 486.022705078125px;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl_w_VtfQMB0UrQ9QXTNR-xKH_-CAnHOTLAwRwxc7g0HDgThZzVblRjmC4T1dAtjSxjc8EL65o7GDsQlPizZAi21zJ5OozAeSvMqnoWkA5I8pzLR4RNf1IyOyin4y1ApM25P_Dq1c5Xqb0/s1600/gambas+y+arduino.png" imageanchor="1" style="clear: left; color: blue; float: left; margin-bottom: 1em; margin-right: 1em; text-decoration: none;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl_w_VtfQMB0UrQ9QXTNR-xKH_-CAnHOTLAwRwxc7g0HDgThZzVblRjmC4T1dAtjSxjc8EL65o7GDsQlPizZAi21zJ5OozAeSvMqnoWkA5I8pzLR4RNf1IyOyin4y1ApM25P_Dq1c5Xqb0/s1600/gambas+y+arduino.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" /></a></div>
<br /><div style="text-align: center;">
<span class="Apple-style-span" style="font-size: medium;"><b>Arduino y Gambas</b></span></div>
<div style="text-align: center;">
<span class="Apple-style-span" style="font-size: medium;"><b>Mi primera aplicación</b></span></div>
<div style="text-align: center;">
<br /></div>
Hoy os traigo mi primera aplicación conGambas y Arduino.<br />Es algo muy sencillo,el tipico encendido de led y apagado, pero bueno... por algun lado hay que empezar... :)<br /><br />Hay que diferenciar 2 partes:<br /><i>La programación de arduino:</i><br />Lo primero que hace es conectarse al puerto serie a una velocidad 9600, y mandar un mensaje "Conectado con el Arduino.Hello world". Luego entra en un loop, donde según reciba el valor "1" o "0", enciende o apaga el led conectado al puerto 13, enviando el correspondente mensaje al puerto de serie de "Arduino: He apagado/encendido el led 13"<br /><br /><div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #993333;">int</span> dato<span style="color: #339933;">;</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #993333;">void</span> setup<span style="color: #339933;">()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">{</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span> Inicializamos puerto serie a <span style="color: #0000dd;">9600</span> bps</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">begin</span><span style="color: #339933;">(</span><span style="color: #0000dd;">9600</span><span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
pinMode<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span> OUTPUT<span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span> Enviamos <span style="color: red;">"Hello World"</span> con salto de línea al final</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span class="IL_AD" id="IL_AD9" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Serial</span>.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: red;">"Conectado con el Arduino. Hello world!"</span><span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span>arduino manda esta cadena al PC</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #993333;">void</span> loop<span style="color: #339933;">()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">{</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span>¿Existen datos por el puerto serie<span style="color: #339933;">?</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #b1b100;">if</span> <span style="color: #339933;">(</span>Serial.<span style="color: #202020;">available</span><span style="color: #339933;">())</span> <span style="color: #339933;">{</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span>Guardamos el dato por la variable dato</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
dato<span style="color: #339933;">=</span>Serial.<span style="color: #202020;">read</span><span style="color: #339933;">();</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span> Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span>dato<span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #b1b100;">switch</span> <span style="color: #339933;">(</span>dato<span style="color: #339933;">)</span> <span style="color: #339933;">{</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #b1b100;">case</span> <span style="color: #0000dd;">49</span><span style="color: #339933;">:</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span> escribo <span style="color: #0000dd;">1</span> en el PC y lo envio</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span>Apagamos el led <span style="color: #0000dd;">13</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span>LOW<span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: red;">"Arduino: He apagado el led 13"</span><span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: black;"><b>break</b></span><span style="color: #339933;">;</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #b1b100;">case</span> <span style="color: #0000dd;">48</span><span style="color: #339933;">:</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span> escribo <span style="color: #0000dd;">0</span> en el PC y lo envio al arduino</div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">//</span>Encendemos el led <span style="color: #0000dd;">13</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
digitalWrite<span style="color: #339933;">(</span><span style="color: #0000dd;">13</span><span style="color: #339933;">,</span>HIGH<span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
Serial.<span style="color: #202020;">println</span><span style="color: #339933;">(</span><span style="color: red;">"Arduino: He encendido el led 13"</span><span style="color: #339933;">);</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: black;"><b>break</b></span><span style="color: #339933;">;</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">}</span></div>
<br /><br />Por otro lado esta el programa en gambas (basado en el ejemplo que traegambas sobre el puerto serie):<br /><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYahfvFxt5l7ELeuCzKs4fVV1crSsLbY_rw_dwPsxkDPdZXtO7XC-o8YXxhOoFHGSYtzepahzv2muawEs6VbklHk6KP-OGwo1T39UpmGhdaN1-5Tt4PbB_RGNFnpESuXCxPDk_XjWZmUvS/s1600/Pantallazo-Serial+Port%253A+Conexion+Arduino.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYahfvFxt5l7ELeuCzKs4fVV1crSsLbY_rw_dwPsxkDPdZXtO7XC-o8YXxhOoFHGSYtzepahzv2muawEs6VbklHk6KP-OGwo1T39UpmGhdaN1-5Tt4PbB_RGNFnpESuXCxPDk_XjWZmUvS/s320/Pantallazo-Serial+Port%253A+Conexion+Arduino.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
<br />Lo que hace el programa es configurar el puerto serie, y esperar al que el usuario pulse el <span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">boton</span> de "Abrir" que se encarga de abrir el puerto y dejar las propiedade del boton de icono led verde activo, para que podamos pulsar sobre el.<br /><br />Cuando pulsas sobre el boton, manda un mensaje al arduino, el mensaje varia si esta encendido o apagado (variable "encendido")<br /><br /><div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: teal;"><i>' Gambas class file</i></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;"><span class="IL_AD" id="IL_AD12" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">PUBLIC</span></span><span style="color: #339933;"> encendido </span><span style="color: #ff8000;">AS</span><span style="color: #339933;"> </span><span style="color: red;"><span class="IL_AD" id="IL_AD11" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Boolean</span></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> Form_Close()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">IF</span><span style="color: #339933;"> Sport.</span><span style="color: blue;">Status</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> Net.</span><span style="color: blue;">Active</span><span style="color: #339933;"> </span><span style="color: #ff8000;">THEN</span><span style="color: #339933;"> </span><span style="color: #0600ff;">CLOSE</span><span style="color: #339933;"> Sport</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> Button1_Click()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">IF</span><span style="color: #339933;"> Sport.</span><span style="color: blue;">Status</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> Net.</span><span style="color: blue;">Active</span><span style="color: #339933;"> </span><span style="color: #ff8000;">THEN</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">CLOSE</span><span style="color: #339933;"> Sport</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Button1.</span><span style="color: blue;">Text</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: grey;">"Abrir"</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Label3.</span><span style="color: blue;">Enabled</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">FALSE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">ToolButtonLed.</span><span style="color: blue;">enabled</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">FALSE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #ff8000;">ELSE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: teal;"><i>' Line parameters</i></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">PortName</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> TxtPort.</span><span style="color: blue;">Text</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">Speed</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> CmbSpeed.</span><span style="color: blue;">Text</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">Parity</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> CmbParity.</span><span style="color: blue;">Index</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">DataBits</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> CmbData.</span><span style="color: blue;">Text</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">StopBits</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> CmbStop.</span><span style="color: blue;">Text</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: teal;"><i>' keep DTR on</i></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">FlowControl</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> ComboBox1.</span><span style="color: blue;">Index</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">Open</span><span style="color: #339933;">()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">TextArea1.</span><span style="color: blue;">Text</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: grey;">"Port Abierto : "</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> Sport.</span><span style="color: blue;">PortName</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: grey;">" Settings : "</span><span style="color: #339933;"> </span><span style="color: green;">&</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">Speed</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: grey;">","</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> Sport.</span><span style="color: blue;">Parity</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: grey;">","</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> Sport.</span><span style="color: blue;">DataBits</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: grey;">","</span><span style="color: #339933;"> </span><span style="color: green;">&</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">StopBits</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: #0600ff;">Chr</span><span style="color: #339933;">(</span><span style="color: red;">13</span><span style="color: #339933;">) </span><span style="color: green;">&</span><span style="color: #339933;"> </span><span style="color: #0600ff;">Chr</span><span style="color: #339933;">(</span><span style="color: red;">10</span><span style="color: #339933;">)</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Button1.</span><span style="color: blue;">Text</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: grey;">"Cerrar"</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Label3.</span><span style="color: blue;">Enabled</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">TRUE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">ToolButtonLed.</span><span style="color: blue;">enabled</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">TRUE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">END</span><span style="color: #339933;"> </span><span style="color: #0600ff;">IF</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> SPort_Read()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">DIM</span><span style="color: #339933;"> s </span><span style="color: #ff8000;">AS</span><span style="color: #339933;"> </span><span style="color: #ff8000;">String</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">READ #Sport, s, </span><span style="color: #0600ff;">Lof</span><span style="color: #339933;">(Sport)</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">TextArea1.</span><span style="color: blue;">Text</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> TextArea1.</span><span style="color: blue;">Text</span><span style="color: #339933;"> </span><span style="color: green;">&</span><span style="color: #339933;"> s</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> ComboBox1_Click()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">Sport.</span><span style="color: blue;">FlowControl</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> ComboBox1.</span><span style="color: blue;">Index</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> Form_Open()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">ME</span><span style="color: #339933;">.</span><span style="color: blue;">center</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">cmbSpeed.</span><span style="color: blue;">Index</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> cmbSpeed.</span><span style="color: blue;">Find</span><span style="color: #339933;">(</span><span style="color: grey;">"9600"</span><span style="color: #339933;">)</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<br /></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #ff8000;">PUBLIC</span><span style="color: #339933;"> </span><span style="color: #0600ff;">SUB</span><span style="color: #339933;"> ToolButtonLed_Click()</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">IF</span><span style="color: #339933;"> encendido </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">FALSE</span><span style="color: #339933;"> </span><span style="color: #ff8000;">THEN</span><span style="color: #339933;"></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">TRY</span><span style="color: #339933;"> </span><span style="color: #ff8000;">PRINT</span><span style="color: #339933;"> #Sport, </span><span style="color: grey;">"0"</span><span style="color: #339933;"> </span><span style="color: teal;"><i>'enciendo led</i></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #0600ff;">IF</span><span style="color: #339933;"> </span><span style="color: #ff8000;">ERROR</span><span style="color: #339933;"> </span><span style="color: #ff8000;">THEN</span><span style="color: #339933;"> Message.</span><span style="color: blue;">Error</span><span style="color: #339933;">(</span><span style="color: grey;">"tienes que abrir el puerto"</span><span style="color: #339933;">)</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">ToolButtonLed.</span><span style="color: blue;"><span class="IL_AD" id="IL_AD7" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">Picture</span></span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> Picture[</span><span style="color: grey;">"ledVerdeEncendido.jpg"</span><span style="color: #339933;">]</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">encendido </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">TRUE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #ff8000;">ELSE</span><span style="color: #339933;"></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;"></span><span style="color: #ff8000;">PRINT</span><span style="color: #339933;"> #Sport, </span><span style="color: grey;">"1"</span><span style="color: #339933;"> </span><span style="color: teal;"><i>'apago led</i></span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">ToolButtonLed.</span><span style="color: blue;">Picture</span><span style="color: #339933;"> </span><span style="color: green;">=</span><span style="color: #339933;"> Picture[</span><span style="color: grey;">"ledVerdeApagado.jpg"</span><span style="color: #339933;">]</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">encendido </span><span style="color: green;">=</span><span style="color: #339933;"> </span><span style="color: #0600ff;">FALSE</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #339933;">ENDIF</span></div>
<div style="background-color: #99ccff; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0cm;">
<span style="color: #0600ff;">END</span></div>
<br />Os dejo un video para que veais como funciona:<br /><div class="separator" style="clear: both; text-align: center;">
</div>
<br /><br /><br /><br /><b>Codigo fuentes:</b><br />Arduino: <a href="http://manualgambasenaleman.googlecode.com/files/puertoSerie.pde" style="color: blue; text-decoration: none;" target="_blank">puertoSerieEncendidoYapagado.pde</a><br />Gambas: <a href="http://manualgambasenaleman.googlecode.com/files/SerialPort-Arduino%200.0.18.tar.gz" style="color: blue; text-decoration: none;" target="_blank">SerialPort-Arduino 0.0.18.tar.gz</a><br /><br /><b>fuentes:</b><br /> Me he basado en las explicaciones de este blog:<br /><a href="http://www.craswer.net/2011/02/arduino-y-puerto-serie/" style="color: blue; text-decoration: none;">http://www.craswer.net/2011/02/arduino-y-puerto-serie/</a><br />Y en el ejemplo que trae gambas2 sobre el puerto serie.<br /><br /><b>Nota: </b>22/01/2012<br /><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5A19O_MHP-dpse-Hwv4nHwim4kzZurt8ByFZTb3RVkixfa4-drj8UH5-uvXsZ8qfkPXVnAo0y3zWAe4mHqbifhhyphenhyphenojluXYCb-8YK3ZJbEM81ByG9UZSrYb51iBWOPS1SvbWx2orFrMlOh/s1600/cero+y+uno+en+ASCII.png" imageanchor="1" style="color: blue; margin-left: 1em; margin-right: 1em; text-decoration: none;"><img border="0" height="257" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5A19O_MHP-dpse-Hwv4nHwim4kzZurt8ByFZTb3RVkixfa4-drj8UH5-uvXsZ8qfkPXVnAo0y3zWAe4mHqbifhhyphenhyphenojluXYCb-8YK3ZJbEM81ByG9UZSrYb51iBWOPS1SvbWx2orFrMlOh/s320/cero+y+uno+en+ASCII.png" style="-webkit-box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; border: 1px solid rgb(238, 238, 238); box-shadow: rgba(0, 0, 0, 0.0980392) 1px 1px 5px; padding: 5px; position: relative;" width="320" /></a></div>
Lo que esta leyendo el arduino es la "salida" que genera la <span class="IL_AD" id="IL_AD5" style="background-attachment: scroll !important; background-color: transparent !important; background-image: none !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(27, 142, 222) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(27, 142, 222) !important; cursor: pointer !important; display: inline !important; float: none !important; font-size: 13.63636302947998px !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;">aplicación</span> Gambas.<br /><br />Gambas le envia un caracter "1" o "0" (no el número el 1 o 0).<br /><br />El caracter "0" corresponde en la tabla ASCII al 48,<br />Y el caracter "1" corresponde en la tabal ASCII al 49<br /><br />Por eso el tema de usar el 48 y el 49 en el código de Arduino.<br /><br />Nota:<br />Una entrada interesante sobre lectura de entras analogicas:<br /><a href="http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDEQFjAA&url=http%3A%2F%2Fplatea.pntic.mec.es%2F%7Emhidalgo%2Fdocumentos%2F04_2011_EntradasAnalogicas.pdf&ei=duguT6rcHNOBhQfts4WCCw&usg=AFQjCNH2BooTBKKIlgGrNE4GFWNj9cuFAw&sig2=3jowRw23996gFHStD4_nzw" style="color: blue; text-decoration: none;">http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDEQFjAA&url=http%3A%2F%2Fplatea.pntic.mec.es%2F~mhidalgo%2Fdocumentos%2F04_2011_EntradasAnalogicas.pdf&ei=duguT6rcHNOBhQfts4WCCw&usg=AFQjCNH2BooTBKKIlgGrNE4GFWNj9cuFAw&sig2=3jowRw23996gFHStD4_nzw</a><br /><br />Otra entrada interesante:<br /><a href="http://recursostic.educacion.es/observatorio/web/es/equipamiento-tecnologico/didactica-de-la-tecnologia/944-monografico-arduinoblocks?showall=1" style="color: blue; text-decoration: none;">http://recursostic.educacion.es/observatorio/web/es/equipamiento-tecnologico/didactica-de-la-tecnologia/944-monografico-arduinoblocks?showall=1</a><br /><br />Y otro..<br /><a href="http://www.arduinoacademy.com/" style="color: blue; text-decoration: none;">http://www.arduinoacademy.com/</a><br /><br /><b>Notas: </b><br />03/05/2012<br />Podeis ver un ejemplo más complejo en el siguiente enlace:<br /><a href="http://jsbsan.blogspot.com.es/2012/05/arduino-y-gambas3-lectura-y-graficos-de.html" style="color: blue; text-decoration: none;" target="_blank">http://jsbsan.blogspot.com.es/2012/05/arduino-y-gambas3-lectura-y-graficos-de.html</a><br /><br />19/05/2012<br />Podeis ver otro ejemplo (con dos ServoMotores) en este enlace:<br /><a href="http://jsbsan.blogspot.com.es/2012/05/gambas-y-arduino-moviendo-dos.html" style="color: blue; text-decoration: none;">http://jsbsan.blogspot.com.es/2012/05/gambas-y-arduino-moviendo-dos.html</a></div>
jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-27117163279346990462012-05-05T05:32:00.000-07:002012-05-05T05:38:30.872-07:00Reloj para arduino: ds1307<br />
<br />
<a href="http://www.zimagez.com/zimage/capturadepantalla-050512-142948.php">
<img src="http://www.zimagez.com/miniature/capturadepantalla-050512-142948.php" />
</a>
<br />
<br />
<br />
<img src="http://www.zimagez.com/miniature/capturadepantalla-050512-143140.php" /><br />
<br />
<br />
<a href="http://www.zimagez.com/zimage/capturadepantalla-050512-143312.php">
<img src="http://www.zimagez.com/miniature/capturadepantalla-050512-143312.php" />
</a>
<br />
<br />
<br />
<br />
<div style="background-color: whitesmoke; color: #555558; font-family: Georgia, 'Times New Roman', serif; font-size: 11px; line-height: 17px; margin-bottom: 7px; margin-top: 9px; text-align: left;">
El conexionado del <strong>Dallas DS1307</strong> también es muy <em>sencillo</em>:</div>
<ul style="background-color: whitesmoke; color: #555558; font-family: Georgia, 'Times New Roman', serif; font-size: 11px; line-height: 17px; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 0px; text-align: left;">
<li style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-left: 30px;">alimentación de 5v en la pata 8</li>
<li style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-left: 30px;">una pila de botón de 3v. del tipo <em>BR3032 </em>en la pata 3 (para conservar la fecha y hora)</li>
<li style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-left: 30px;">un cristal de cuarzo de <em>32.768kHz</em> en las patas 1 y 2</li>
<li style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-left: 30px;">masa en la pata 4</li>
<li style="list-style-image: initial; list-style-position: outside; list-style-type: disc; margin-left: 30px;">comunicaciones en la 6 con el <strong>SCL </strong>y en la 5 con el <strong>SDA</strong></li>
</ul>
<div style="background-color: whitesmoke; color: #555558; font-family: Georgia, 'Times New Roman', serif; font-size: 11px; line-height: 17px; margin-bottom: 7px; margin-top: 9px; text-align: left;">
Para utilizar con el <a href="http://www.arduino.cc/" style="color: #3c657b; font-weight: bold;" title="arduino">Arduino</a> solamente hay que conectar el <strong>SCL </strong>por ejemplo a la entrada <em>analógica 5</em>del <a href="http://www.arduino.cc/" style="color: #3c657b; font-weight: bold;" title="arduino">Arduino</a> y el <strong>SDA</strong> a la entrada <em>analógica 4</em>.</div>
<div style="background-color: whitesmoke; color: #555558; font-family: Georgia, 'Times New Roman', serif; font-size: 11px; line-height: 17px; margin-bottom: 7px; margin-top: 9px; text-align: left;">
Hay que conectarlas con resistencias en <a href="http://en.wikipedia.org/wiki/Pull-up_resistor" style="color: #3c657b; font-weight: bold;" title="pull-up en wiki">pull-up</a> de 2.2K en cada canal</div>
<br />
<br />
<a href="http://aacftp.googlecode.com/files/rtcds1307.zip" target="_blank">Código fuente: rtcds1307.zip</a><br />
<br />
<br />
Fuentes:<br />
<br />
<a href="http://www.hispavila.com/3ds/atmega/ds1307reloj.html">http://www.hispavila.com/3ds/atmega/ds1307reloj.html</a><br />
<br />
<br />
<a href="http://www.carballada.com/wordpress/2008/07/fecha-hora-y-arduino">http://www.carballada.com/wordpress/2008/07/fecha-hora-y-arduino</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-13500560367832034402012-04-29T12:29:00.000-07:002012-04-29T12:30:40.962-07:00Modulo SD card para Arduino<a href="http://www.ladyada.net/products/microsd/">http://www.ladyada.net/products/microsd/</a><br />
<br />
<br />
<br />
<a href="http://imageshack.us/photo/my-images/42/giradomicrosdwiring.png/" target="_blank" title="ImageShack - Image And Video Hosting"><img border="0" src="http://img42.imageshack.us/img42/2671/giradomicrosdwiring.png" /></a>
<a href="http://imageshack.us/photo/my-images/842/89338824.jpg/" target="_blank" title="ImageShack - Image And Video Hosting"><img border="0" src="http://img842.imageshack.us/img842/5513/89338824.jpg" /></a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-58628172662378730862012-04-29T11:29:00.000-07:002012-04-29T11:29:19.970-07:00Sensor de ultrasonidos, HC SR04 para medir distancias con Arduino<h4>
Fuente:</h4>
<h4>
<a href="http://www.ardublog.com/library-for-arduino-ultrasonic-ranging-hc-sr04/">http://www.ardublog.com/library-for-arduino-ultrasonic-ranging-hc-sr04/</a>
</h4>
<table cellspacing="0" class="li"><tbody>
<tr><td class="pic p140 lt"><br /></td><td class="dtl"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td><td class="pay"><br /></td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<a class="img" href="http://www.ebay.es/itm/Sensor-de-distancia-HC-SR04-ultrasonido-arduino-y-microcontroladores-/190665460153?pt=LH_DefaultDomain_186&hash=item2c648c09b9" style="margin-left: 1em; margin-right: 1em;"><img alt="Imagen de artículo" class="img" src="http://thumbs2.ebaystatic.com/m/mpvvb46nmSBoMgEWQ5jcFEg/140.jpg" /></a></div>
<br />
<br />
Libreria mejorada:<br />
<a href="http://aacftp.googlecode.com/files/Ultrasonic_rev2.zip" target="_blank">Ultrasonic_rev2.zip</a><br />
<br />
<br />
Codigo ejemplo de uso:<br />
<br />
<pre>#include
Ultrasonic ultrasonic(9,8); <span style="color: #7e7e7e;">// (Trig PIN,Echo PIN)</span>
<span style="color: #cc6600;">void</span> <span style="color: #cc6600;"><b>setup</b></span>() {
<span style="color: #cc6600;"><b>Serial</b></span>.<span style="color: #cc6600;">begin</span>(9600);
}
<span style="color: #cc6600;">void</span> <span style="color: #cc6600;"><b>loop</b></span>()
{
<span style="color: #cc6600;"><b>Serial</b></span>.<span style="color: #cc6600;">print</span>(ultrasonic.Ranging(CM)); <span style="color: #7e7e7e;">// CM or INC</span>
<span style="color: #cc6600;"><b>Serial</b></span>.<span style="color: #cc6600;">println</span>(<span style="color: #006699;">" cm"</span> );
<span style="color: #cc6600;">delay</span>(100);
}</pre>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-22865092693650778612011-11-14T08:57:00.000-08:002011-11-14T08:57:40.968-08:00Instalar SOFTWARE de Arduino en Ubuntu 10.04 y 10.10<div class="separator" style="clear: both; text-align: center;"></div><div style="margin-left: 1em; margin-right: 1em;"><a href="http://arduino.cc/en/uploads/Main/arduino316.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="" border="0" class="alignright" height="220" src="http://arduino.cc/en/uploads/Main/arduino316.jpg" title="arduino" width="316" /></a><span class="Apple-style-span" style="font-size: large;">INSTALAR SOFTWARE DE </span></div><div style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="font-size: large;">ARDUINO EN UBUNTU 10.04</span></div><div style="margin-left: 1em; margin-right: 1em;"><br />
</div><br />
<br />
Otra forma muy sencilla de Instalar Arduino en Ubuntu 9.10 y 10.04 es a través del repositorio de Arduino para Ubuntu, para ello seguimos los siguientes pasos en un terminal de Linux, «menú Aplicaciones >Accesorios > Terminal»:<br />
<br />
<br />
1) «sudo add-apt-repository ppa:arduino-ubuntu-team». Añade el repositorio de ubuntu a las orígenes desoftware de tu equipo.<br />
2) «sudo apt-get update». Actutaliza los orígenes de software de tu equipo y por tanto los repositorios.<br />
3) «sudo apt-get install arduino». Instala Arduino con todas sus dependencias.<br />
4) Arduino aparece en el «menú Aplicaciones > Programación > Arduino».<br />
Nota: las ordenes que tengan «sudo» delante requieren permisos de administrador y por tanto pedirá lacontraseña de adminsitrador.<br />
<br />
Para la Ubuntu 10.10 desde el «centro de software de Ubuntu» se podrá instalar directamente.<br />
<br />
<br />
<br />
Fuente:<a href="http://cosaspedroruiz.wordpress.com/2010/09/05/instalar-arduino-en-ubuntu-10-04-y-10-10/"> http://cosaspedroruiz.wordpress.com/2010/09/05/instalar-arduino-en-ubuntu-10-04-y-10-10/</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-29799430818541567022011-09-28T13:02:00.000-07:002011-09-28T13:02:55.774-07:00web sobre pic y arduino: tutoelectro<div class="separator" style="clear: both; text-align: center;"><a href="http://www.tutoelectro.com/" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="63" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixWUl1mcFABvCllHIc54xhd1FH2oqKhfhBKAyxYd0wmlrASYV8S5bFfZ8cDOXbOvTypBBJdMS6VmnMOXNz6vZCEe5gbPPBZwHxuoHvVvHioaoc4U6RHCDDjuJsnEB-F5D_2kXrPT8gEgBC/s320/tutoelectro.png" width="320" /></a></div>Muy buena web y con muchos video tutoriales sobre electronica, pic y arduinos.<br />
<br />
Aconsejable 100%<br />
<br />
<a href="http://www.tutoelectro.com/">http://www.tutoelectro.com/</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-46461516910223045922011-09-10T04:13:00.000-07:002011-09-10T04:13:30.253-07:00Como solucionar conversiones de unidades de medidas www.convertworld.com<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-p8wnrUIrXlRxoqP3w9LlWF7DC1aOQ5jBXiLVOjsfGUekB4JGlwJUAPxuvQKmEPQWvp4gqzgc9-HRoYfzsw1cFmkUdjVAw0u2VaoSpGRypdZ_jOjK7LeZaqQRu-KwJjncaBhhl9toLcXJ/s1600/convertworld+conversion+de+unidades+de+medidas.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="80" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-p8wnrUIrXlRxoqP3w9LlWF7DC1aOQ5jBXiLVOjsfGUekB4JGlwJUAPxuvQKmEPQWvp4gqzgc9-HRoYfzsw1cFmkUdjVAw0u2VaoSpGRypdZ_jOjK7LeZaqQRu-KwJjncaBhhl9toLcXJ/s200/convertworld+conversion+de+unidades+de+medidas.png" width="200" /></a></div><div style="text-align: center;"><span style="font-size: large;"> www.convertworld.com</span></div><div style="text-align: center;"><span style="font-size: large;">conversión de unidades de medida</span></div><br />
Muchas veces tengo dudas sobre la conversión de unidades de distintas medidas, sobre todo las eléctricas. He buscado en google, varias páginas que hacen las conversiones a las distintas undidades.<br />
<br />
La que me ha gustado más es esta:<br />
<a href="http://www.convertworld.com/es/capacidad-electrica/">http://www.convertworld.com/es/capacidad-electrica/</a><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7rYTsBlmG2mZo-LNrjmvn8m7O-X2GrQaDAXl8UG3EPQ9FBHua1mYqtywY2S-d2fvZMMBCFVtZtjrBaWhcb4f-lWOCipjQzrJh1B0kcilhaJMridJMe7PyRabsvikWYeSXB4HjabX2npow/s1600/pagina+web+de+convertworld.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7rYTsBlmG2mZo-LNrjmvn8m7O-X2GrQaDAXl8UG3EPQ9FBHua1mYqtywY2S-d2fvZMMBCFVtZtjrBaWhcb4f-lWOCipjQzrJh1B0kcilhaJMridJMe7PyRabsvikWYeSXB4HjabX2npow/s400/pagina+web+de+convertworld.png" width="397" /></a></div>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-5434300083590820862011-09-09T09:37:00.000-07:002011-09-09T09:37:59.822-07:00Explicación : Que es un Registro de Desplazamiento. Ejemplo de uso del 74ls164NFuente Original: <a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm"> http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm</a><br />
<br />
<br />
<br />
<br />
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse;"><tbody>
<tr><td bgcolor="#FFFFFF" style="border-style: none; border-width: medium;" width="3%"></td> <td bgcolor="#FFFFFF" style="border-style: none; border-width: medium;" width="64%"><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"> <span style="color: navy;"><b><a href="http://www.blogger.com/post-create.g?blogID=8164430897462235804" name="intro"></a>INTRODUCCIÓN:<br />
</b></span>Un "registro de desplazamiento" es una configuración circuítal muy utilizada, generalmente para convertir un flujo de datos en forma serial a uno del tipo paralelo, motivo por el cual a menudo los chips encargados de esta tarea son llamados "conversores serie-paralelo".</span></span></div><div align="justify"><span style="font-size: x-small;"> <span style="font-family: Verdana;">Por supuesto, es posible construir un registro de este tipo a partir de componentes discretos, aunque en la practica resulta no solo inapropiado por cuestiones de tamaño y velocidad, si no también económicas, ya que un chip como los que mencionaremos en este texto rara vez superan el valor de 1 u$s.</span></span></div></td> </tr>
</tbody></table><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"><b> <span style="color: navy;"><a href="http://www.blogger.com/post-create.g?blogID=8164430897462235804" name="indice"></a>ÍNDICE:<br />
</span><span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#intro">Introducción</a></span></span><br />
<span style="font-size: x-small;"><span style="font-family: Verdana;"><b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#elregistro">El registro de desplazamiento</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#74LS164N">El circuito integrado 74HC164N</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <span style="color: grey;">El circuito integrado 74HC4094 (en preparación)</span><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#circuito">Un circuito real</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/matrizled7x32/matrizLED7x32.htm">Ejemplos prácticos: Cartel de LEDs de 7x32 con PIC</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.ucontrol.com.ar/Articulos/Display4x7seg/4x7seg.htm">Ejemplos prácticos: Display LEDs de 4 dígitos de 7 segmentos</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.alldatasheet.com/datasheet-pdf/pdf/23048/STMICROELECTRONICS/74164.html">Hoja de datos del 74HC164N</a><br />
<b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> <a href="http://www.alldatasheet.com/datasheet-pdf/pdf/46159/SLS/SL74HC4094N.html">Hoja de datos del 74HC4094</a></span></span></div><div align="center"> <ins style="border: none; display: inline-table; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
<ins id="aswift_1_anchor" style="border: none; display: block; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
</div><div align="justify"><span style="font-family: Verdana;"><b> <span style="color: navy; font-size: x-small;"><a href="http://www.blogger.com/post-create.g?blogID=8164430897462235804" name="elregistro"></a></span></b></span><span style="font-size: x-small;"><span style="font-family: Verdana;"><b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> </span></span><span style="font-family: Verdana;"><b> <span style="color: navy; font-size: x-small;">El registro de desplazamiento:<br />
</span></b><span style="font-size: x-small;">La mejor manera de entender conceptos nuevos es apoyándose en analogías con temas que nos son familiares. En este caso no vamos a hacer una excepción, por lo que utilizaremos como ejemplo el funcionamiento de una cola, como la de un banco o supermercado.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"> Supongamos que dos tipos de personas pueden formar parte de una cola. Estos dos tipos de personas son las que se ven en la figura siguiente, y es imposible confundir una con otra. Es decir, siempre estaremos seguros que en una posición determinada de la fila esta una u otra persona. Las llamaremos "0" (el "gordito) y "1" (al mas flaco). <br />
Aclaro que la elección de los personajes solo tiene que ver con el parecido (?) con el 0 y el 1.</span></span></div><div align="center"><img border="0" height="102" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image1.gif" width="122" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">"0" y "1", nuestros personajes.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">La cola que usaremos como ejemplo tiene 8 lugares, que hemos numerado del 0 al 7, pero nada impide trabaja con colas más largas, por lo que todo lo que se vea aquí, puede ser generalizado para colas de la longitud que se desee.<br />
</span></span></div><div align="center"><img border="0" height="31" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image2.gif" width="541" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">La cola utilizada como ejemplo tiene 8 posiciones.</span></span></div><div align="justify"><br />
<span style="font-size: x-small;"><span style="font-family: Verdana;">Otra particularidad de nuestra hipotética cola es que nunca puede estar vacía. Todas sus posiciones tienen que estar ocupadas, ya sea por "gorditos" o "flacos". En el estado inicial, la cola se encuentra completamente llena de "gorditos", como se a continuación:</span></span><br />
</div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image2b.gif" width="542" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">El estado inicial de la cola es este: completa de "gorditos".</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Nuestra cola funciona como cualquier cola de la vida real: cuando alguien nuevo llega a la fila, se coloca en el lugar de mas atrás, que en este caso corresponde a la "posición 0". Como la cola tiene una longitud máxima (en nuestro ejemplo) de 8 posiciones, para hacer lugar al recién llegado, es necesario que todos los que estaban en la fila "avancen" una posición. El que estaba en la posición 0 pasa la 1, el que estaba en la 1 pasa a la 2, y así hasta llegar al que estaba en la posición 7, que "sale" por el extremo opuesto.<br />
</span></span></div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image5.gif" width="750" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Llega un nuevo integrante a la cola....<br />
</span></span></div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image6.gif" width="750" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">...y ocupa el ultimo lugar, desplazando a todos los demás una posición. El primero "sale" de la fila.</span></span></div><div align="center"><br />
</div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image7.gif" width="750" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Este es el estado final de nuestra fila, con el nuevo integrante en el último lugar.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Si continuaran ingresando personas en la fila, el proceso se repetiría con cada nuevo integrante que llegue. Como el que entra primero es el primero en salir, a este tipo de colas se las llama "<b>FIFO</b>", por <b>First Input, First Output</b> (Primero que entra, primero que sale).</span></span></div><div align="center"> <ins style="border: none; display: inline-table; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
<ins id="aswift_2_anchor" style="border: none; display: block; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
</div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Con todas estas cuestiones en mente podemos seguir avanzando en la comprensión del funcionamiento de los registros de desplazamiento. Supongamos que queremos que en la cola haya dos flacos en los primeros lugares, luego un gordo, otra vez dos flacos, luego otro gordo por ultimo dos flacos más (como siempre, 8 personas en total). Sabiendo que cada personaje que ingresa en la cola "empuja" a todos una posición a la derecha, si queremos que el que termine ocupando el extremo derecho de la cola sea un flaco, ese será el que primero debe entrar. Siguiendo el razonamiento anterior, los personajes deberían entrar en la fila en el orden siguiente:</span></span></div><div align="justify"><br />
</div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image9.gif" width="750" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Los nuevos integrantes de la fila, esperando para ocupar su lugar.</span></span></div><div align="center"><br />
</div><div align="center"><img border="0" height="130" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image12.gif" width="750" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Este es el estado final de nuestra fila, con los integrantes originales desplazados hacia la derecha.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"> Poniendo fin a nuestra analogía, tendríamos que los integrantes de esta hipotética cola son los "0"s y "1"s (o estados altos y bajos) de nuestros circuitos, es decir, nuestros datos. La cola en si es el registro de desplazamiento. Cuando decíamos que el estado inicial de la cola eran 8 gordos, estábamos queriendo decir que al alimentar nuestro circuito, todas las salidas estarán en "0" o estado bajo.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Hay una salvedad, y es la existencia del "reloj". Efectivamente, en un circuito real, los datos pasan al registro de desplazamiento con cada pulso de reloj. Podemos pensar en este reloj como si se tratase de un "maestro de ceremonias", que da una palmada cada vez que alguien debe ingresar en la cola. </span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Muchos circuitos de registros de desplazamiento "reales" también incluyen un sistema de RESET, que permite poner simultáneamente todas las salidas en "0" o estado bajo, sin necesidad de ingresar 8 ceros seguidos. Esto permite limpiar rápidamente el registro de desplazamiento.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Cuando decimos "<i>rápidamente</i>" nos referimos a que como la velocidad de los pulsos del reloj (CLOCK) no puede ser infinita (típicamente el máximo ronda los 10 o 20 MHz) y cada dato demora el tiempo de un pulso de reloj en desplazarse por el registro, introducir 8 "0"s llevaría 800 ns (100 ns * 8 bits), contra los 100 ns que demora en aplicarse el RESET. No obstante, para obtener los tiempos exactos implicados se debe consultar la hoja de datos del integrado que estemos utilizando, ya que los limites varían incluso con la tensión de alimentación y la temperatura.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"><a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#indice">[Volver al Índice]</a></span></span><br />
</div><div align="justify"><b><a href="http://www.blogger.com/post-create.g?blogID=8164430897462235804" name="74LS164N"></a></b><span style="font-size: x-small;"><span style="font-family: Verdana;"><b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> </span></span><b><span style="color: navy; font-size: x-small;"> <span style="font-family: Verdana;">El 74LS164N:<br />
</span></span></b><span style="font-size: x-small;"><span style="font-family: Verdana;">Este interesante circuito integrado de la familia TTL viene en diferentes “sabores”, de acuerdo a la velocidad, temperatura de operación, voltajes y corrientes soportadas, etc. Dichas características dependen de las letras entre el “74” y el “164”. </span></span></div><div align="center"><img border="0" height="125" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/regist2.gif" width="200" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">El integrado 74LS2164N, un registro de<br />
desplazamiento de 8 bits.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Desde el punto de vista técnico, dentro de este integrado se encuentra un “registro de desplazamiento” completo, de 8 bits de largo. Esto significa que se comporta como un conversor serie-paralelo, en el que se introducen pulsos de reloj por un pin (<b>CP</b>) y datos en serie por otro (dos en realidad, unidos por una compuerta <b>AND</b>, cuyas entradas son <b>DSA</b> y <b>DSB</b>). Las 8 salidas van toman los estados indicados por el “tren” de datos de la entrada. Dispone de un pin (el 9) que realiza la función de poner en cero todas las salidas (Reset, <b>MR</b> en el esquema de abajo).</span></span></div><div align="center"><img border="0" height="188" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/regist1.gif" width="631" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Esquema interno del integrado 74LS2164N<br />
</span></span></div><div align="center"><img border="0" height="255" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image11.gif" width="357" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Diagrama lógico, extraído de la hoja de datos de Motorola.</span></span><br />
</div><div align="center"><img border="0" height="147" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image10.gif" width="319" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Función de cada patilla del 74LS2164N</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Los pines 1 y 2 son la entrada de datos. Como dijimos antes, internamente existe una compuerta <b>AND</b> que realiza el producto lógico de los valores de ambas entradas. En general, se unen entre si para que el resultado de la función <b>AND</b> sea igual al valor del dato (ver <a href="http://www.ucontrol.com.ar/Articulos/Compuertas/compuertas.htm">compuertas lógicas</a>) o bien se pone una de las entradas en alto (conectándola a +5V) para que la otra entrada sea la que determine el valor de la salida. Cualquiera de las dos formas es válida. Por supuesto, existen aplicaciones donde se obtienen datos de dos fuentes distintas, en cuyo caso se conectará una entrada de la compuerta a cada una.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Los pulsos de clock entran por el pin 8. Los datos de la entrada se reflejan en la salida con cada transición bajo-alto del reloj. </span></span></div><div align="center"><img border="0" height="92" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image14.gif" width="416" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">La flecha indica el flanco de subida del clock.</span></span></div><div align="center"><img border="0" height="143" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image13.gif" width="229" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Tabla de verdad del integrado (Motorola).</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">Los pines 3,4,5,6 ,10,11,12 y 13 son (en ese orden) las salidas.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"><a href="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/registros_de_desplazamiento_74164_4094.htm#indice">[Volver al Índice]</a></span></span></div><div align="center"> <ins style="border: none; display: inline-table; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
<ins id="aswift_3_anchor" style="border: none; display: block; height: 90px; margin: 0; padding: 0; position: relative; visibility: visible; width: 728px;"></ins><br />
</div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;"> <a href="http://www.blogger.com/post-create.g?blogID=8164430897462235804" name="circuito"></a><b> <span style="color: #ff6600;">></span><span style="color: navy;"> </span></b> </span></span><b><span style="color: navy; font-size: x-small;"> <span style="font-family: Verdana;">Un circuito real:<br />
</span></span></b><span style="font-size: x-small;"><span style="font-family: Verdana;">El siguiente es un ejemplo de conexión de un <b>74HC164N</b>:</span></span></div><div align="center"><img border="0" height="142" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image15.gif" width="175" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Ejemplo de conexión.</span></span></div><div align="justify"><span style="font-size: x-small;"><span style="font-family: Verdana;">En el supuesto caso de necesita un registro de desplazamiento mas largo, se utilizan mas circuito integrados (uno por cada 8 bits de largo del registro). Simplemente se deben unir entre si todos los terminales de Clock y Reset (para que funcionen al mismo tiempo) y la ultima salida de uno con la entrada del siguiente, de manera que cada dato que se "desborda" de uno circuito se hace presente en la entrada del siguiente.</span></span></div><div align="center"><img border="0" height="155" src="http://www.ucontrol.com.ar/Articulos/registros_de_desplazamiento_74164_4094/Image16.gif" width="507" /><br />
<span style="color: #ff6600; font-size: x-small;"><span style="font-family: Verdana;">Registro de desplazamiento de 32 bits de largo.</span></span></div>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-51079349362416979032011-09-08T08:13:00.000-07:002011-09-08T08:28:26.308-07:00Uso del chip Shift Register (74HC595) en Arduino<h3 class="post-title entry-title">Fuente: </h3><h3 class="post-title entry-title"><a href="http://ricardforner.blogspot.com/2011/08/uso-del-chip-shift-register-74hc595-en.html">http://ricardforner.blogspot.com/2011/08/uso-del-chip-shift-register-74hc595-en.html </a></h3><h3 class="post-title entry-title">Uso del chip Shift Register (74HC595) en Arduino </h3><div class="post-header"></div><div style="text-align: justify;">El chip <span style="font-weight: bold;">74HC595</span> nos permite utilizar una entrada de datos serie, y convertir un byte a 8 salidas en paralelo. Mediante el uso de una entrada de DATA, una de CLOCK y un LATCH, conseguimos con sólo 3 pines de Arduino procesar 8 salidas paralelas digitales. </div><div style="text-align: justify;"><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5JkBqkEhIcRkeYEGDi42A2Y7vNwmvkXkflLUqQo2wON1rlw6aoYhgMwmcJy2XRaYOMvLWDDCtyIbsKaq0_cUvcT9Cvc2_8nYYP6EV0WaIso4fU9DZhJcHnpH3VbFDI4z9MxOfzPPMh7s/s1600/paroca2011080905.jpg"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5638920215380098930" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5JkBqkEhIcRkeYEGDi42A2Y7vNwmvkXkflLUqQo2wON1rlw6aoYhgMwmcJy2XRaYOMvLWDDCtyIbsKaq0_cUvcT9Cvc2_8nYYP6EV0WaIso4fU9DZhJcHnpH3VbFDI4z9MxOfzPPMh7s/s400/paroca2011080905.jpg" style="cursor: hand; cursor: pointer; display: block; height: 236px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a>Destacar que pueden encadenarse varios chips, por lo que si añadimos <span style="font-style: italic;">un segundo chip </span>podemos tener 16 salidas paralelas simultáneas con 2 bytes, y así sucesivamente. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzLdq5FWaewO6Z-ttERz0ozpORjo236SrVRVAf8XgrdPysC8lUexVjV-g5hmlvgzr50eFR-8Lc2bFEy0dT9b2lm4pE8GZ5RIXbiZdAHllLZhIEHd4RyXuJMHt9eQqOl8R-_TAlWOU8ZCA/s1600/paroca2011080906.jpg"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5638921987235998370" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzLdq5FWaewO6Z-ttERz0ozpORjo236SrVRVAf8XgrdPysC8lUexVjV-g5hmlvgzr50eFR-8Lc2bFEy0dT9b2lm4pE8GZ5RIXbiZdAHllLZhIEHd4RyXuJMHt9eQqOl8R-_TAlWOU8ZCA/s400/paroca2011080906.jpg" style="cursor: hand; cursor: pointer; display: block; height: 264px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a> <br />
<span style="font-family: verdana; font-weight: bold;">CIRCUITO</span> <br />
Nuestro prototipo para probar la conversión de serie a digital que nos facilita el <span style="font-weight: bold;">595</span> se basa en el esquema siguiente: <br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe25__-a3wWOciwQ2VhNvLL4aSA3WFGpEmjmDBMR_Qdk3Pq3H_mSBV_NFvOF4JldJ7_ZA5CPYdnjayHkaj36jmVUFNssoJxvd_KpYtS9wQKE64wrB9RHJFybQ3ie8CuVhAbPDY6Ujiizk/s1600/paroca2011080902.jpg"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5638915798267739602" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhe25__-a3wWOciwQ2VhNvLL4aSA3WFGpEmjmDBMR_Qdk3Pq3H_mSBV_NFvOF4JldJ7_ZA5CPYdnjayHkaj36jmVUFNssoJxvd_KpYtS9wQKE64wrB9RHJFybQ3ie8CuVhAbPDY6Ujiizk/s400/paroca2011080902.jpg" style="cursor: hand; cursor: pointer; display: block; height: 246px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a> <br />
<span style="font-family: verdana; font-weight: bold;">PROTOTIPO</span> <br />
El prototipo implementado en una <span style="font-style: italic;">protoboard </span>tiene éste aspecto. <br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUDFLcBys1_emygAQ5ugVu5T9WcRu56UlW48IjiC2XqxafOMrMbSW2L0mXqp4fZ7oFtJAkHvCqYwXyqGxBmGDx7pwpwyWb6o9lBDqK9yhII0JkBvVgNGk4NYOiQT0S-tqzPQtDkOkdmrE/s1600/paroca2011080904.jpg"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5638917695745657538" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUDFLcBys1_emygAQ5ugVu5T9WcRu56UlW48IjiC2XqxafOMrMbSW2L0mXqp4fZ7oFtJAkHvCqYwXyqGxBmGDx7pwpwyWb6o9lBDqK9yhII0JkBvVgNGk4NYOiQT0S-tqzPQtDkOkdmrE/s400/paroca2011080904.jpg" style="cursor: hand; cursor: pointer; display: block; height: 304px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a> <br />
<span style="font-family: verdana; font-weight: bold;">CÓDIGO FUENTE DE ARDUINO</span> <br />
La prueba se basa en el sistema de señalización del <a href="http://ricardforner.blogspot.com/search/label/Proyecto%20PAROCA">Proyecto PAROCA I</a>, en que se muestran 5 LEDs en frecuencia estroboscópica (10ms / 64 ms) y un LED tricolor en que se mostrará el estado de la batería. </div><pre style="background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-yFeVAtptN2w41Xtrb57giiwgHErRNe2D53CFGUhWWmcFWpASWdul7ndWXUMC2aGgCRRR9WtT2kVgQxE5Xo4zkuPxQZUwVPkFeJwoAM3GwAgknmkqF9M6JjZAz72L3Ad2tfjGjkBEAP8G/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: 250px; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> /*
Proyecto.....: PAROCA I
Descripcion..: Plataforma Robotica de Carga
Autor........: Ricard Forner (RFKSolutions.es)
Version......: 0.0.1
Fecha........: 03/08/2011
Código fuente: Arduino
*/
//Pin conectado a latch pin (ST_CP) del 74HC595
const int latchPin = A1;
//Pin conectado a clock pin (SH_CP) del 74HC595
const int clockPin = A0;
//Pin conectado a Data in (DS) del 74HC595
const int dataPin = A2;
//// Luces intermitentes / strobe
int seqLED[5] = {8+16, 8+16, 32+64, 32+64, 128};
//// Luces estado bateria
const int batteryOk = 2; // verde
const int batteryLow = 1; // rojo
int batteryStatus;
void setup() {
initLuces();
batteryStatus = batteryOk;
}
void loop() {
doLuces(batteryStatus);
}
void initLuces() {
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
}
void doLuces(int status) {
for (int n=0; n<5; n++) {
digitalWrite(latchPin, LOW);
delay(10);
shiftOut(dataPin, clockPin, MSBFIRST, status+seqLED[n]);
digitalWrite(latchPin, HIGH);
delay(12);
}
}
</code></pre><a href="http://i.creativecommons.org/l/by/3.0/nl/88x31.png"><img alt="" border="0" src="http://i.creativecommons.org/l/by/3.0/nl/88x31.png" style="cursor: hand; cursor: pointer; float: left; height: 31px; margin: 0 10px 10px 0; width: 88px;" /></a> <br />
<br />
<br />
<span style="font-family: verdana; font-weight: bold;">VÍDEOS</span> <br />
Como resultado de lo publicado en el presente artículo, un par de vídeos de su funcionamiento. <br />
<br />
<br />
<a href="http://youtu.be/rz4-_nKAxuc">http://youtu.be/rz4-_nKAxuc</a><br />
<br />
<br />
Video de una rotación secuencial de los LEDs. <br />
<br />
<br />
<a href="http://youtu.be/Z6gJ21Cs3ME">http://youtu.be/Z6gJ21Cs3ME</a><br />
<div style="text-align: center;"><br />
</div><span class="post-author vcard"> Publicado por <span class="fn">Ricard Forner</span> </span>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-87267064492574070522011-09-05T08:19:00.000-07:002011-09-05T08:23:03.927-07:00Ampliación a 32 canales por puerto paralelo<span style="font-family: Arial;">Me voy a basar en este articulo, para realizar el circuito y el programa en Gambas2, para controlar la aplicación de las salidas con leds: </span><br />
<br />
<span style="font-size: large;"><b>Articulo Original:</b></span><br />
<i><span style="font-family: Arial;">----------------------------------------------------------------------------------------------------------------------</span></i><br />
<i><span style="font-family: Arial;">Autor: <a href="mailto:canello@hotmail.com">Pablo Canello</a></span></i><br />
<i><br />
</i><br />
<i><b>Dirección original del articulo:</b></i><br />
<i><a href="http://www.pablin.com.ar/electron/circuito/computer/lpt32/index.htm">http://www.pablin.com.ar/electron/circuito/computer/lpt32/index.htm</a></i><br />
<br />
<div align="left"><i><span style="font-family: Arial;">Este circuito permite conectar hasta cuatro módulos de control de potencia a un mismo puerto paralelo del PC. Dicho puerto no necesariamente debe ser bidireccional, por lo que cualquier PC por mas antiguo que sea servirá para controlar este sistema.</span></i></div><div align="center"><i><img border="0" height="944" src="http://www.pablin.com.ar/electron/circuito/computer/lpt32/circuito.gif" width="463" /></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Si bien a simple vista el circuito parece demasiado complejo, en verdad no lo es. Veamos detalladamente su funcionamiento: Cada integrado es un latch octal, éstos sirven para retener un dato (presente en su entrada) en su salida solo cuando una señal específica se presente. Para hacerlo mas simple: Los pines 2 al 9 de cada integrado son las entradas de datos, los pines 12 al 19 son las salidas, el pin 11 se denomina en inglés Latch Enanble, una entrada de control que causa que los pines 12 al 19 reflejen el dato presente en los pines 2 al 9. Esto quiere decir, a su vez, que los datos presentes en las salidas del integrado no sufren cambios por mas que los datos en la entrada del mismo cambien constantemente siempre y cuando la entrada de control (pin 11) este a masa. Cuando esta entrada de control va a estado alto (a 5v) las salidas quedan conectadas con las entradas haciendo que lo presente en ellas quede reflejado en las salidas. Si dicho terminal de control (pin 11) se mantiene alto y el dato presente en las entradas cambia, el presente en las salidas cambiará también. Como vemos, las entradas de datos de los cuatro integrados están unidas en paralelo. Esto quiere decir que el dato presente en los pines 2 al 9 del puerto paralelo de la PC (los datos presentes en el bus de datos del puerto paralelo) estarán presentes en los cuatro integrados al mismo tiempo. Para que un dato presente en el puerto paralelo del PC solo vaya a modificar un grupo de salidas y no los cuatro usamos los pines de control para determinar cual o cuales integrados deseamos accionar. Esto se logra gracias a que cada pin de control del puerto paralelo maneja solo un integrado. De esta forma logramos controlar 32 salidas independientes (en grupos de 8 salidas por activación). </span></i></div><div align="left"><i><span style="font-family: Arial;">Cómo controlarlo:</span></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">El soft de la PC puede estar escrito en el lenguaje que queramos, siempre que éste tenga la capacidad de poder utilizar el puerto paralelo de la PC. Como no sabemos en que estado se encuentra el puerto paralelo y, por ende, nuestra placa de expansión, lo primero que tiene que hacer el soft es inicializar el circuito. Para eso, pone en 0 el bus de datos del puerto paralelo, con lo que todos sus pines (del 2 al 9) quedan a masa. Luego, espera 10mS para que el dato se establezca en las entradas de los integrados. En realidad, con 1mS alcanza y sobra, pero como el tiempo en este caso nos sobra mejor darle un poco de tiempo extra. Luego de transcurridos los 10mS activamos los cuatro integrados poniendo altos los cuatro pines de control del puerto paralelo. Seguidamente esperamos otros 10mS para que los latches retengan los datos en las salidas y por último ponemos bajos (en cero) todos los pines de control del puerto paralelo con lo que los integrados dejan en las salidas todas los pines apagados (a masa) sin importar el dato que aparezca en sus entradas de ahora en mas. Con esto el módulo quedará inicializado y todas las salidas apagadas.</span></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Cuando se quiera modificar el estado de un grupo de salidas (cada grupo es de ocho salidas y están indicados como Salidas A, Salidas B, Salidas C, Salidas D) se deberá poner en el puerto paralelo (en el bus de datos de éste) el dato que se desea colocar en la salidas del integrado. Luego esperar 10mS para que el dato se establezca correctamente en las entradas de los integrados. Luego poner en alto (en uno) la salida de control del puerto paralelo que comande el integrado que se desea modificar y esperar otros 10mS para que el dato se fije correctamente en los latches de salida del mismo. Transcurrido este tiempo volver a bajar (poner a cero) la salida de control que se subió y el proceso habrá concluido. Es recomendable que, tanto la rutina de inicialización como la de control, esperen 10mS luego de terminar de ejecutarse, a fin de dar un tiempo entre cada ejecución para evitar posibles fallas de activación.</span></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Otro factor muy importante a tener en cuenta es que algunos de los pines de control del puerto paralelo presentan un estado lógico invertido con respecto a la tensión. Esto quiere decir que, un pin con estado lógico normal presenta tensión cuando el bit que lo controla esta a 1 y está a masa cuando su bit se pone en cero. Pero, un pin con lógica inversa, presentará tensión cuando su bit este en cero y masa cuando este en uno. Hay que prestar atención a esto para evitar problemas de control con los integrados o activaciones erráticas.</span></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Este circuito se utiliza en combinación con etapas de control de potencia que le permitirán al usuario manejar artefactos como cargas de 220V, motores, lámparas o incluso relés (que permitirán realizar cualquier acción eléctrica). En el caso de utilizar el sistema para manejar lámparas ú otras cargas resistivas es recomendable el uso de <a href="http://www.pablin.com.ar/electron/circuito/computer/triac220/index.htm">etapas de potencia con triacs</a>, pero si se van a manejar motores, conmutar circuitos de combinación ú otro tipo de diseños que requieran llaves mecánicas entonces se deberán utilizar <a href="http://www.pablin.com.ar/electron/circuito/computer/8relelpt/index.htm">etapas de potencia con relés</a>. Si lo que se desea es tan solo experimentar lo recomendable es colocar a la salida de cada pin de los integrados una resistencia de 470 ohms, un diodo led con su ánodo a masa tal como un <a href="http://www.pablin.com.ar/electron/circuito/computer/lptmonit/index.htm">monitor de puerto paralelo</a>. Esto será útil para chequear que el sistema funcione correctamente sin necesidad de conectarle otros dispositivos.</span></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Es muy aconsejable leer la nota <a href="http://www.pablin.com.ar/electron/info/lpt/index.htm">"Puerto paralelo estándar o SPP"</a> disponible en la sección Información general de electrónica en nuestro sitio. Leer y analizar la <a href="http://www.pablin.com.ar/electron/circuito/computer/lpt32/74hct573.pdf">hoja de datos del 74HCT573</a> es algo muy aconsejable también.</span></i></div><div align="left"><i><br />
</i></div><div align="center"><i><img border="0" height="193" src="http://www.pablin.com.ar/electron/circuito/computer/lpt32/foto.jpg" width="581" /></i></div><div align="center"><i><span style="font-family: Arial;">Vista del equipo terminado y funcionando (con LED's de prueba).</span></i></div><div align="left"><i><span style="font-family: Arial;">El programa Panel 32:</span></i></div><div align="center"><i><img border="0" height="265" src="http://www.pablin.com.ar/electron/circuito/computer/lpt32/panel32.jpg" width="267" /></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Este programa permite controlar fácilmente cada una de las 32 salidas de este módulo. Para ello basta con hacer un click sobre el interruptor que se desea accionar y la salida correspondiente adoptará el estado debido. Como funciones extra, este programa contiene memoria de encendido, que permite "recordar" la configuración actual de los interruptores y adoptarla en cada encendido. También dispone de cinco memorias las que se pueden establecer, modificar o eliminar con mucha facilidad. Para evitar confusiones a la hora de activar algo hemos incluido un sistema de títulos que el usuario puede definir y aparecerán cuando el mouse pase por sobre cada interruptor. Estos títulos se definen haciendo click derecho sobre los botones y para que los mismos no se pierdan cuando el programa se cierre hay una opción dentro del menú 'Archivo' para salvarlos en un archivo. Por último el menú 'Configuración' permite elegir el puerto paralelo a utilizar y establecer el tiempo de delay (que varía en algunas máquinas). Este delay es un ciclo for next que itera normalmente diez mil veces luego de enviar datos al puerto para que los latches retengan los mismos.</span></i></div><div align="center"><i><span style="font-family: Arial;"><a href="http://www.pablin.com.ar/electron/circuito/computer/lpt32/panel32.zip">Bajar el programa Panel 32</a></span></i></div><div align="left"><i><span style="font-family: Arial;">El programa Control 32:</span></i></div><div align="center"><i><img border="0" height="301" src="http://www.pablin.com.ar/electron/circuito/computer/lpt32/ctrl32.jpg" width="354" /></i></div><div style="text-align: justify;"><i><span style="font-family: Arial;">Este otro programa si bien parece mucho mas complejo en verdad tiene menos código operable que el anterior y, adicionalmente, no es tan automático. Lo hicimos con la idea de mostrar al que este interesado en programar para esta placa de 32 salidas como debe hacerlo para que funcione eficientemente y, para facilitar aún mas las cosas, incluimos una suerte de ticket donde se puede observar las funciones ejecutadas en el programa. En este caso el dato a enviar debe establecerse presionando con el mouse sobre los ocho LED's contenidos en el recuadro 'Dato:'.Una vez que encendimos los LED's que queremos ver encendidos en el módulo presionamos El control correspondiente. Si presionamos el botón 'Todos los latch's' se enviará el dato a los cuatro latches, quedando el mismo igual en todas las salidas. Por último el botón 'Inicializar' apaga todos los LED's y envía eso a los cuatro latches, quedando todo en cero. El casillero 'Limpiar' ubicado sobre el monitor o ticket de actividad permite vaciar la lista con la próxima actividad a registrar.</span></i></div><div align="center"><i><span style="font-family: Arial;"><a href="http://www.pablin.com.ar/electron/circuito/computer/lpt32/ctrl32.zip">Bajar el programa Control 32</a></span></i><br />
<i><span style="font-family: Arial;">---------------------------------------------------------------------------------------------------------------------- </span></i><br />
<br />
<br />
<div style="text-align: left;"><b><span style="font-family: Arial;">Lo voy a montar con estos componentes </span></b><i><span style="font-family: Arial;"><br />
</span></i></div></div><div align="left"><br />
<span style="font-size: small;"><b>ficha técnica (data sheet) de los que compré:</b></span><br />
<br />
<span style="font-size: large;"><b><span style="font-size: small;"><a href="http://www.ebay.es/itm/260793985581?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649#shId">comprado en ebay en agosto de 2011</a></span></b></span></div><table border="2"><tbody>
<tr><td><span style="font-size: small;"><br />
</span></td> </tr>
<tr> <td align="left" nowrap="nowrap"><span style="font-size: small;"><b> N.º Ref. del fabricante:</b></span> </td> <td><h1><span style="font-size: small;"> 74HC573N,652</span></h1></td> </tr>
<tr> <td align="left" nowrap="nowrap"><span style="font-size: small;"><b> Fabricante:</b></span> </td> <td><h2><span style="font-size: small;"><a href="http://es.mouser.com/nxpsemiconductors/" id="ctl00_ContentMain_hlnk10">NXP Semiconductors</a> </span> </h2></td></tr>
</tbody></table><br />
<br />
<div style="text-align: center;"><a href="http://proyectojulio.googlecode.com/files/74HC_HCT573-1.pdf">Enlace de descarga ficha tecnica</a></div><br />
Esquema de pinning:<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-aHg7Zldqr4ozuo6VOBxhQcQ__mf5LpVOqsEn2eeVRxYMKtqXCZyjmAtmaUFZ8VC4T6ExO9oZp93y199J7Z4Iw_v4hgfNxUm4wTHyH7WrMwiH5RP6-8ethePiL8xnvrj4YFlx3kp6umV0/s1600/74hc573+esquema+pinning.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-aHg7Zldqr4ozuo6VOBxhQcQ__mf5LpVOqsEn2eeVRxYMKtqXCZyjmAtmaUFZ8VC4T6ExO9oZp93y199J7Z4Iw_v4hgfNxUm4wTHyH7WrMwiH5RP6-8ethePiL8xnvrj4YFlx3kp6umV0/s320/74hc573+esquema+pinning.png" width="259" /></a></div>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-65793856726290526482011-08-22T11:56:00.000-07:002011-08-22T12:02:11.984-07:00Manual Stamp Works.Este manual es muy interesante, sobre todo el tema de "Avanzado". <br />
<div style="text-align: justify;">La expansión de entradas y salidas, es una de las cosas que tendremos que hacer para aprovechar al máximo nuestro equipos para controlar elementos.</div><br />
Descarga: <a href="http://www.aprenderobotica.com/page/stamp-works">http://www.aprenderobotica.com/page/stamp-works</a><br />
<br />
Indice del cóntenido<br />
<br />
Prefacio <br />
Introducción <br />
Obtenga el Mayor Provecho de las Prácticas de StampWorks <br />
Tres Pasos para Tener Éxito con StampWorks<br />
Prepare su Plaqueta StampWorks.<br />
Contenido de este Kit <br />
Preparación de la Protoboard <br />
Bases de la Programación <br />
Contenido de un Programa <br />
Saltos – Redireccionando el Flujo de un Programa<br />
Bucles – Ejecutando el código una y otra vez.<br />
Subrutinas – Código reutilizable que ahorra espacio de programa<br />
Estilo de Programación .<br />
Plantilla .<br />
Convención sobre Nombres.<br />
Hora de Experimentar .<br />
Aprendiendo los Conceptos de Programación.<br />
Construcción de Proyectos <br />
Que hacer entre proyectos <br />
Experimento 1: Hacer Titilar un LED <br />
Experimento 2: Hacer Titilar un LED (Versión 2) <br />
Experimento 3: Contador con LEDs<br />
Experimento 4: Pantalla de LEDs de Ciencia Ficción .<br />
Experimento 5: Gráficos con LEDs (Punto o Barra)<br />
Experimento 6: Un Juego Simple <br />
Experimento 7: Controlador de Luces.<br />
Building Circuits On Your Own .<br />
Usando Displays de 7 Segmentos <br />
Experimento 8: Contador de un Dígito .<br />
Experimento 9: Dado Digital .<br />
Experimento 10: Reloj con Pantalla de LEDs <br />
<br />
Usando LCDs <br />
Experimento 11: Demostración Básica con LCD <br />
Experimento 12: Creando Caracteres en un LCD <br />
Experimento 13: Leyendo la RAM del LCD <br />
Experimento 14: Juego de la Bola 8 Mágica<br />
<br />
Avanzando<br />
Experimento 15: Filtrando Múltiples Entradas <br />
Experimento 16: Contando Eventos .<br />
Experimento 17: Medición de Frecuencia .<br />
Experimento 18: Medición Avanzada de Frecuencia<br />
Experimento 19: Theremin Controlado por Luz<br />
Experimento 20: Efectos de Sonido <br />
Experimento 21: Entrada Analógica con PULSIN <br />
Experimento 22: Salida Analógica con PWM<br />
Experimento 23: Expandiendo Salidas.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3EwrEpzyt2TUy18qwgSmxvsvyW0tqcgiSfbqsbyuVR7a-szzWbxwHvyHoFlLm61fk2-UOJ1FRjWSRmx9gcDYAabwwoTQ3o4qsbefepvW3HIznG0FfSyCo2g-pK8ZGUe6HDa49GbPyHcTa/s1600/expansion+de+salidas.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="299" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3EwrEpzyt2TUy18qwgSmxvsvyW0tqcgiSfbqsbyuVR7a-szzWbxwHvyHoFlLm61fk2-UOJ1FRjWSRmx9gcDYAabwwoTQ3o4qsbefepvW3HIznG0FfSyCo2g-pK8ZGUe6HDa49GbPyHcTa/s320/expansion+de+salidas.png" width="320" /></a></div><br />
Experimento 24: Expandiendo Entradas<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt42Wn6SJMpL0HuZ8Xkf6pLanW7sfM2uxBGtv6DwAqYF2WWm-4r2pzf3DOvc9EEmrf59cJVmpswYVqZ3f9vz6im7BfZspY79QLJyZwr6_LPUnRd151Yz9S2DXM02dmP5glgYqDDgJFm4z4/s1600/expansion+de+entradas.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjt42Wn6SJMpL0HuZ8Xkf6pLanW7sfM2uxBGtv6DwAqYF2WWm-4r2pzf3DOvc9EEmrf59cJVmpswYVqZ3f9vz6im7BfZspY79QLJyZwr6_LPUnRd151Yz9S2DXM02dmP5glgYqDDgJFm4z4/s320/expansion+de+entradas.png" width="320" /></a></div><br />
Experimento 25: Control de un Servo<br />
Experimento 26: Motor Paso a Paso<br />
Experimento 27: Medición de Tensión.<br />
Experimento 28: Medición de Temperatura .<br />
Experimento 29: Multiplexado de 7 Segmentos<br />
Experimento 30: Reloj de Tiempo Real .<br />
Experimento 31: Comunicaciones Seriales <br />
Trabajando por su Cuenta<br />
Apéndice A: Hojas de Datos <br />
Apéndice B: Manual del BASIC Stamp II, Versión 2.0 <br />
<br />
<script type="text/javascript"><!--
google_ad_client = "pub-5168402283346310";
/* 468x60, creado 22/08/11 */
google_ad_slot = "6465552861";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-45883253648526776862011-08-22T11:32:00.000-07:002011-08-22T11:41:09.772-07:00¿que es una protoboard?Para hacer los montajes de las actividades y experimentar con ellos, lo mas económico es usar las protoboard, ya que no necesitan soldadura, y los elementos los podemos reutizar, cambiar de sitio, ampliar, etc. <br />
<br />
Video: Uso de un protoboard<br />
<iframe allowfullscreen="" frameborder="0" height="345" src="http://www.youtube.com/embed/Ah-Nl-iycwM" width="560"></iframe><br />
<br />
Nota:<br />
Fijaos que usa alambre calibre AWG #22 en vez de cable para hacer las conexiones.<br />
<br />
<script type="text/javascript"><!--
google_ad_client = "pub-5168402283346310";
/* 468x60, creado 22/08/11 */
google_ad_slot = "6465552861";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-65658880978923638032011-08-22T11:23:00.000-07:002011-08-22T11:42:21.020-07:00Algo de electrónica: manual para pequeños montajes<div style="text-align: justify;">En la siguiente dirección os podéis bajar varios manuales donde vienen explicados pequeños y sencillos circuitos para realizar.</div><br />
<div style="text-align: justify;">Aunque viene referidos <a href="http://www.aprenderobotica.com/group/eslaprimeravez">a microcontroladores BASIC Stamp</a> de <a href="http://www.parallax.com/"><i>Parallax Inc</i></a> la información y explicación de los conceptos a lo largo del libro, el montaje de los ejemplos, y actividades, los podemos aplicar sin tener dicho microcontrolador, y haciendo alguna adaptación del "PBASIC" (lenguaje que usa el BASIC Stamp) al lenguaje que usemos nosotros (C, <a href="http://gambas.sourceforge.net/en/main.html">Gambas</a>,<a href="http://www.lazarus.freepascal.org/"> Lazarus</a>), podemos disponer con nuestro ordenador y como medio de comunicación el puerto paralelo a la protoboard donde estemos montando la actividad.</div><br />
<script type="text/javascript"><!--
google_ad_client = "pub-5168402283346310";
/* 468x60, creado 22/08/11 */
google_ad_slot = "6465552861";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
<br />
Enlace de descarga de manual:<a href="http://www.aprenderobotica.com/page/que-es-un-microcontrolador"> ¿que es un microcontrolador?</a><br />
<div style="text-align: center;"><br />
</div><div style="text-align: center;"><br />
Índice del manual</div><div style="text-align: left;">Prefacio <br />
Características de la version 3.0 <br />
Usuarios.Foros de ayuda<br />
Recursos para educadores</div><div style="text-align: left;">Traducciones en otros idiomas<br />
Datos del autor <br />
Contribuidores especiales Capítulo 1 : Inicio.</div><div style="text-align: left;">¿Actualmente cuántos microcontroladores utilizamos? <br />
El BASIC Stamp2 es un modulo nuevo con microcontrolador <br />
Inventos maravillosos realizados con los microcontroladores BASIC Stamp..<br />
Hardware y software....<br />
Actividad #1 : Instalación del software.<br />
Actividad #2 : Uso del archivo “ayuda” para ajustes del hardware.<br />
Resumen <br />
<b>Capítulo 2 : Encendiendo y Apagando Luces</b> <br />
Luces Indicadoras.<br />
Energizando un diodo emisor de luz (LED) <br />
Actividad #1 : Construccion y verificacion de un circuito con LED <br />
Actividad #2 : Control de apag/enc con el BASIC Stamp <br />
Actividad #3 : Conteo y repetición <br />
Actividad #4 : Construyendo y verificando un segundo circuito con LED<br />
Actividad #5 : Control de un LED bicolor usando la dirección de la corriente <br />
Resumen .<br />
<b>Capítulo 3 : Entrada Digital – Botones Push </b><br />
Los encuentras en calculadoras, juegos de mano y aparatos.<br />
Recibiendo versus mandando señales high y low..<br />
Actividad #1 : Verificando un botón push con un circuito LED <br />
Actividad #2 : Leyendo un botón push con el BASIC Stamp<br />
Actividad #3 : Control con botón push de un circuito LED..<br />
Actividad #4 : Dos botones push controlando dos circuitos LEDs<br />
Actividad #5 : Prueba del tiempo de reacción de un temporizador <br />
Resumen <br />
<b>Capítulo 4 : Controlando el Movimiento </b><br />
Microcontrol del movimiento <br />
Señales encendido/apagado y movimiento del motor <br />
Presentando al servomotor.<br />
Actividad #1 : Conectando y verificando el servo <br />
Actividad #2 : Programa de prueba del control del servo <br />
Actividad #3 : Control del tiempo de retención del servo<br />
Página 4 · ¿Qué es un Microcontrolador?<br />
Actividad #4 : Controlando la posición con su computadora <br />
Actividad #5 : Convirtiendo posición a movimiento <br />
Actividad #6 : Botónes push – Para controlar el servo <br />
Resumen <br />
<b>Capítulo 5 : Midiendo Rotación.</b><br />
Ajustando perillas y monitoreando máquinas <br />
El resistor variable atrás de la perilla - el potenciometro <br />
Actividad #1 : Midiendo y verificando el circuito potenciometro <br />
Actividad #2 : Midiendo la resistencia al medir el tiempo <br />
Actividad #3 : Leyendo la perilla con el BASIC Stamp <br />
Actividad #4 : Controlando un servo con un potenciometro <br />
Resumen <br />
<b>Capítulo 6 : Indicadores Digitales.</b><br />
El indicador digital de todos los dias.<br />
¿Qué es un indicador de 7 segmentos?<br />
Actividad #1 : Construyendo y verificando el indicador LED de 7 segmentos..</div><div style="text-align: left;">Actividad #2 : Controlando el indicador LED de 7 segmentos.<br />
Actividad #3 : Mostrando digitos<br />
Actividad #4 : Mostrando la posición de un dial.<br />
Resumen <br />
<b>Capítulo 7 : Midiendo Luz</b><br />
Dispositivos que contienen sensores de luz.</div><div style="text-align: left;">Conociendo el fototransistor <br />
Actividad #1 : Construyendo y verificando el medidor de luz <br />
Actividad #2 : Ajustando los eventos de luz <br />
Actividad #3 : Graficando mediciones de luz (opcional) .<br />
Actividad #4 : Medidor sencillo de luz<br />
Actividad #5 : Salida conmutada (ON/OFF) del fototransistor.<br />
Actividad #6 : Por diversion – Mida luz exterior con un LED <br />
Resumen <br />
<b>Capítulo 8 : Frecuencia y Sonido.</b><br />
Su día y los beeps electrónicos <br />
MIcrocontroladores, bocinas y señales apagado/ encendido<br />
Actividad #1 : Construyendo y verificando la bocina <br />
Actividad #2 : Sonidos en acción<br />
Actividad #3 : Notas musicales y canciones sencillas <br />
Actividad #4 : Música con microcontrolador <br />
Actividad #5 : Tonos telefónicos con RTTTL <br />
Resumen <br />
<b>Capítulo 9 : Bloques de Construcción Electrónicos</b><br />
Los pequeños chips negros.<br />
Expanda sus proyectos con circuitos integrados perifericos <br />
Actividad #1 : Control del flujo de corriente con un transistor.<br />
Actividad #2 : Presentando el potenciometro digital.<br />
Resumen <br />
<b>Capítulo 10 : Realizando sus Propios Inventos </b><br />
Aplique lo que usted ya conoce en otras partes y componentes <br />
Haciendo el prototipo de un sistema de micro seguridad.<br />
Actividad #1 : De la idea a la demonstración del concepto <br />
Actividad #2 : Construya y verifique individualmente cada circuito <br />
Actividad #3 : Organice las tareas de sus códigos en piezas pequeñas.<br />
Actividad #4 : ¡Documente su código! <br />
Actividad #5 : Dele a su aplicación maravillosa nuevas funciones<br />
Actividad #6 : Como resolver diseños dificiles<br />
Actividad #7 : ¿Qué sigue?<br />
Resumen <br />
Anexo A : Lista de Partes y Opciones de Kits <br />
Opciones completas de kits</div><div style="text-align: left;">Anexo B : Más sobre Electricidad <br />
Actividad adicional: Ley de ohm, voltaje y corriente <br />
Anexo C : Resumen del Formato RTTTL <br />
Índice Alfabetico.</div><div style="text-align: center;"><br />
<br />
<br />
<i>Ejemplo de un montaje</i><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1RXX8ly7JbCnkYX2JHqOKVRX8GZvXrpGz6HMJG8TZJ4TDq389X5SKuqs4ppk_gFR7bIDtCPC5nd3w1s0fm9nYYGeWCn7dGpIRsQSFWvNT3LYd8tgSyNQ0GE048si8DH3pe2FsRftYmvvq/s1600/ejemplo+de+montaje.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1RXX8ly7JbCnkYX2JHqOKVRX8GZvXrpGz6HMJG8TZJ4TDq389X5SKuqs4ppk_gFR7bIDtCPC5nd3w1s0fm9nYYGeWCn7dGpIRsQSFWvNT3LYd8tgSyNQ0GE048si8DH3pe2FsRftYmvvq/s320/ejemplo+de+montaje.png" width="320" /></a></div><br />
<br />
</div>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-29172753518594844232011-08-22T10:42:00.000-07:002011-08-22T11:40:09.715-07:00Conocer como montar (y desmontar) nuestro ordenador...Una forma de conocer nuestro ordenador es saber como se monta sus elementos (asi también aprendemos como se desmonta :) ).<br />
<br />
Existen multitud de videos en youtube (algunos mejores que otros) que nos explican con mucho detalle como se monta y desmonta nuestro ordenador.<br />
<br />
<br />
Os traigo hoy un canal de youtube, y que también se emite por tv. <a href="http://www.mundodigital.net/">WWW.MUNDODIGITAL.NET</a><br />
<br />
<a href="http://jsbsan.files.wordpress.com/2010/10/pantallazo6.png"><img alt="" class="aligncenter size-medium wp-image-2263" height="196" src="http://jsbsan.files.wordpress.com/2010/10/pantallazo6.png?w=300" title="Pantallazo" width="300" /></a><br />
<br />
Trata muchos temas de informática y ciencia.<br />
<script type="text/javascript"><!--
google_ad_client = "pub-5168402283346310";
/* 468x60, creado 22/08/11 */
google_ad_slot = "6465552861";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />
Os dejo unos videos de como montar un ordenador moderno (cpu de 6 nucleos, tarjeta grafica, ram, discos duros, etc) de fecha de agosto de 2010. <br />
<br />
<br />
Montaje de un ordenador de 6 nucleos: Agosto 2010<br />
1 parte<br />
<a href="http://www.youtube.com/watch?v=h__Etysrs0A">http://www.youtube.com/watch?v=h__Etysrs0A</a><br />
<br />
2 parte<br />
<a href="http://www.youtube.com/redtves?gl=ES&hl=es#p/u/22/bRaqGOl6Igc">http://www.youtube.com/redtves?gl=ES&hl=es#p/u/22/bRaqGOl6Igc</a><br />
<br />
<br />
3 parte<br />
<a href="http://www.youtube.com/redtves?gl=ES&hl=es#p/u/21/vn3DWth_vWQ">http://www.youtube.com/redtves?gl=ES&hl=es#p/u/21/vn3DWth_vWQ</a><br />
<br />
4 parte<br />
<a href="http://www.youtube.com/redtves?gl=ES&hl=es#p/u/20/n7tLE_9Kc_0">http://www.youtube.com/redtves?gl=ES&hl=es#p/u/20/n7tLE_9Kc_0</a><br />
<br />
5 parte<br />
<a href="http://www.youtube.com/redtves?gl=ES&hl=es#p/u/19/9KJVh6Rdyac">http://www.youtube.com/redtves?gl=ES&hl=es#p/u/19/9KJVh6Rdyac</a><br />
<br />
6 parte<br />
<a href="http://www.youtube.com/redtves?gl=ES&hl=es#p/u/18/qODnp0h7KB8">http://www.youtube.com/redtves?gl=ES&hl=es#p/u/18/qODnp0h7KB8</a>jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0tag:blogger.com,1999:blog-8164430897462235804.post-38211924108914694242011-08-21T13:14:00.000-07:002011-08-21T13:14:27.939-07:00Presentación<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgihuqvcp39QAfDyifKfcFr4jruMTUwFolmpCrMjN4JjKYYAaoCI0nqrJAOx8wC0oFdXiEGxOaW1tHcHSJ1iFpVRode0mcgNJ7kl0l6y6TzUivSlKIHLjoWAIuukiQ0Ak_yJJ-7RW588NRE/s1600/pensamiento+robot.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgihuqvcp39QAfDyifKfcFr4jruMTUwFolmpCrMjN4JjKYYAaoCI0nqrJAOx8wC0oFdXiEGxOaW1tHcHSJ1iFpVRode0mcgNJ7kl0l6y6TzUivSlKIHLjoWAIuukiQ0Ak_yJJ-7RW588NRE/s200/pensamiento+robot.png" width="185" /></a></div><div style="text-align: justify;">Mi hobby es la programación y en este blog esta dedicado a reunir artículos, documentación, ejemplos, montajes, etc... sobre la realización de circuitos controlados por ordenador, para aprender yo mismo y que le sirvan también a los que le interese este tema.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"> Es un tema que siempre me apasionó, controlar maquinas a través de ordenadores, sus aplicaciones prácticas. </div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">La Robótica: </div><br />
<div style="text-align: justify;">Es un tema que aun esta en pañales, como hemos visto hace poco tiempo, en japón, el desastre natural le ha seguido un desastre nuclear ocurrido en la centra de <a href="http://www.elpais.com/articulo/internacional/nueva/cadena/accidentes/complica/situacion/planta/Fukushima/I/elpepuint/20110316elpepuint_1/Tes" target="_blank">Fukushima</a>, en uno de los países mas desarrollados del mundo, sobre todo en el tema de la robótica, apenas se han visto actuar en el desastre... y sin embargo trabajadores ha expuesto su vida al peligro de la radiactividad...</div><div style="text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhisql8KR5XpBQWxVQDDkRUCK_R2gxwM8LJ11aFNCl_E0WsXAjLEAxQe85tW58v3wM8zndAPBuHhEOS6Mhd3lrclquzBw0EXM6szxglkCutDLxAmBL5_EU_yDbRkaKtX_zsE1eUTfHyOWEL/s1600/Especialistas+comprueban+si+un+grupo+de+evacuados+de+la+zona+de+fukushima+sufren+contaminacion+radioactiva.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhisql8KR5XpBQWxVQDDkRUCK_R2gxwM8LJ11aFNCl_E0WsXAjLEAxQe85tW58v3wM8zndAPBuHhEOS6Mhd3lrclquzBw0EXM6szxglkCutDLxAmBL5_EU_yDbRkaKtX_zsE1eUTfHyOWEL/s320/Especialistas+comprueban+si+un+grupo+de+evacuados+de+la+zona+de+fukushima+sufren+contaminacion+radioactiva.png" width="320" /></a></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Esta claro, que nos queda mucho por estudiar, inventar, aplicar en estos temas.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Recuerdo una cita que me comentó un profesor, sobre una reina del siglo XIX, que visitó un laboratorio de un conocido inventor y genio de la electricidad de aquella época, allí vio muchos "juguetes eléctricos" a los cuales ella no entendía como se podía perder el tiempo en ellos.... Hoy idea esos "juguetes" nos rodean en nuestra vida cotidiana, nos facilitan la vida del día a día, incluso sin algunos de esos inventos no podríamos sobrevivir.</div><div style="text-align: justify;"> </div><div style="text-align: justify;">Quizas hoy estamos en esa epoca en lo que se refiere a la robótica, ahora solo hacemos juguetes,</div><div style="text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://www.imagengratis.org/images/robots2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="233" src="http://www.imagengratis.org/images/robots2.jpg" width="320" /></a></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Con alguna aplicación industrial, ya que son entornos muy controlados, osea siempre en las mismas condiciones y trabajos muy monótonos y repetitivos (soldaduras, pintado de coches).</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://www.imagengratis.org/images/robo0107p.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.imagengratis.org/images/robo0107p.jpg" /></a></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Bueno, paso a paso, iré añadiendo artículos, circuitos, experiencias, sobre este tema tan apasionante.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"> </div>Para mas información:<br />
<br />
<a href="http://www.elpais.com/articulo/internacional/Japon/eleva/180/numero/tecnicos/trabajan/interior/central/elpepuint/20110316elpepuint_10/Tes">http://www.elpais.com/articulo/internacional/Japon/eleva/180/numero/tecnicos/trabajan/interior/central/elpepuint/20110316elpepuint_10/Tes</a><br />
<br />
<br />
<br />
<br />
jsbsanhttp://www.blogger.com/profile/17177462906739209567noreply@blogger.com0