<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3817665187453699659</id><updated>2024-10-06T20:15:41.744-07:00</updated><category term="arduino"/><category term="iniciación"/><category term="led"/><category term="IDE"/><category term="alarma"/><category term="analógica"/><category term="arduino standalone"/><category term="arduino stepper solar"/><category term="atmega328"/><category term="atmega328 standalone"/><category term="dd-wrt"/><category term="documental"/><category term="eclipse"/><category term="fonera"/><category term="historia"/><category term="ikea"/><category term="inalámbrico"/><category term="inductancias"/><category term="meta"/><category term="mod"/><category term="motor"/><category term="motor paso a paso"/><category term="nrf24l01"/><category term="puerto serie"/><category term="rgb"/><category term="sensor"/><category term="standalone"/><category term="temperatura"/><category term="tilt"/><category term="ventilador"/><category term="zigbee"/><title type='text'>Arduino Testing...</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-7699816432511595444</id><published>2014-07-01T07:49:00.002-07:00</published><updated>2014-07-01T07:52:14.850-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="inalámbrico"/><category scheme="http://www.blogger.com/atom/ns#" term="nrf24l01"/><category scheme="http://www.blogger.com/atom/ns#" term="zigbee"/><title type='text'>Comunicación inalámbrica con Arduino</title><content type='html'>Una de las dudas que, irremediablemente, tarde o temprano nos asalta cuando empezamos a trabajar con Arduino es &lt;i&gt;¿Y cómo puedo intercambiar datos con un Arduino sin necesidad de usar cables?&lt;/i&gt; Las necesidades para conseguir esto son de lo más variopintas, desde controlar el comportamiento de nuestro Arduino a distancia ya que lo estamos usando para leer datos de un sensor en un lugar apartado del PC, hasta permitir la comunicación inalámbrica de dos Arduinos.
&lt;br /&gt;
&lt;br /&gt;
Existen varias alternativas, cada una con sus pros y sus contras, así que voy a comentar aquí mis experiencias con este tema para que no os volváis locos haciendo pruebas como me pasó a mí :)
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Zigbee&lt;/h3&gt;
En realidad Zigbee es una especificación de protocolos de comunicación inalámbricos definidos por la &lt;i&gt;Zigbee Alliance&lt;/i&gt; y enfocados a entornos de bajo consumo. Varios fabricantes producen módulos compatibles, como el que aparece en la siguiente foto:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOY7oiND29NzKUfQ4jFJ79VVl2IIzUI7GqLhH-kMxzrSyXSryuJkvV7LY4d18ptradXFPKnHj9DijfaORBYPjcbLCbGeed4EFdluJk9UUeVV1SuCf38rRSHSt8LMvtyS2egjkhAFOfK0UE/s1600/xbee.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOY7oiND29NzKUfQ4jFJ79VVl2IIzUI7GqLhH-kMxzrSyXSryuJkvV7LY4d18ptradXFPKnHj9DijfaORBYPjcbLCbGeed4EFdluJk9UUeVV1SuCf38rRSHSt8LMvtyS2egjkhAFOfK0UE/s1600/xbee.jpg&quot; height=&quot;320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Módulo XBee, compatible con el protocolo Zigbee&lt;/span&gt; &lt;/div&gt;
&lt;br /&gt;
Es la opción más elegante y la que mayor alcance y tasa de transferencia
 de datos garantiza, de todas las que veremos en este artículo. Su uso es bastante sencillo, pues en última instancia nos provee de un puerto serie por donde enviaremos y recibiremos los datos intercambiados con otros módulos Zigbee.&lt;br /&gt;
&lt;br /&gt;
Para aquellos que se decidan por Zigbee, existe gran cantidad de documentación y ejemplos para las distintas plataformas de microcontroladores existentes en el 
mercado. Nuestro querido Arduino no podía ser menos y, como era de esperar, disponemos incluso de shields para poder usar módulos Zigbee en nuestros proyectos:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx1pcIpGGohSwle-wTzRmzAAfCh8c9wMTyCBYUSqz-7MzvbWISH5jP35chRJAq2XMYTaHMXvGIUxUD0xNKH5gfgoM_XF7OPrNZR_Iafrj7pJrykww6lXiuQzq6xr74QLrS4TUX8Tjk0F8b/s1600/xbee_shield.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx1pcIpGGohSwle-wTzRmzAAfCh8c9wMTyCBYUSqz-7MzvbWISH5jP35chRJAq2XMYTaHMXvGIUxUD0xNKH5gfgoM_XF7OPrNZR_Iafrj7pJrykww6lXiuQzq6xr74QLrS4TUX8Tjk0F8b/s1600/xbee_shield.jpg&quot; height=&quot;240&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Shield de Arduino para un módulo XBee similar al visto anteriormente&lt;/span&gt; &lt;/div&gt;
&lt;br /&gt;
Como os podréis imaginar, esta opción tiene una pega importante y es el alto coste que implican estos módulos, mucho mayor que el del resto de opciones que veremos.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Módulos con codificación OOK&lt;/h3&gt;
Existen unos módulos de envío y recepción de datos basados en codificación OOK (On/Off Keying) los cuales nos permiten enviar pequeñas cantidades de datos como grupos de unos y ceros. Estos módulos son realmente simples, por lo que no incorporan en el hardware ningún tipo de mecanismo de control de errores, señalización ni direccionamiento; simplemente envían aquello que se les manda a todo aquel que se encuentre a su alcance. Al no disponer de control de flujo ni errores, deberemos ser nosotros los que, mediante código, implementemos dichos controles para garantizar un envío y recepción correctos. Estos módulos se utilizan principalmente en mandos a distancia por radiofrecuencia, ya que su coste es realmente bajo y para pequeños paquetes de datos son más que suficiente, además de que al no necesitar ningún tipo de secuencia de establecimiento de conexión, pueden empezar a emitir rápidamente y finalizar en un corto espacio de tiempo, con lo que el gasto en batería es ínfimo. Podemos encontrar estos módulos, por ejemplo, en eBay:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.ebay.com/sch/i.html?_trksid=p2050601.m570.l1313.TR12.TRC2.A0.X433mhz+module&amp;amp;_nkw=433mhz+module&amp;amp;_sacat=0&amp;amp;_from=R40&quot;&gt;http://www.ebay.com/sch/i.html?_trksid=p2050601.m570.l1313.TR12.TRC2.A0.X433mhz+module&amp;amp;_nkw=433mhz+module&amp;amp;_sacat=0&amp;amp;_from=R40&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Aquí os dejo una foto de la pareja de emisor/receptor que tengo yo:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKI9y0fApUFYyedOLnVa4oHxrrs6tnZhiuaNa1brj2uRflQ2lpv8mUS2_EOXdmxPbo_bqZ2Q1WomJvkTY_yoa8Of45Ezikbx5X0CWfCSU1y1NY30HF-h8KfMVlXQ8aRTRqQ7CZesU6E_sJ/s1600/433mhz_module.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKI9y0fApUFYyedOLnVa4oHxrrs6tnZhiuaNa1brj2uRflQ2lpv8mUS2_EOXdmxPbo_bqZ2Q1WomJvkTY_yoa8Of45Ezikbx5X0CWfCSU1y1NY30HF-h8KfMVlXQ8aRTRqQ7CZesU6E_sJ/s1600/433mhz_module.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Es importante que busquéis módulos que operen en la frecuencia dde 433 Mhz u 868 MHz, que son las frecuencias habilitadas en Europa para uso libre por los ciudadanos. Veréis que hay disponibles módulos de 315 MHz, que se usan en Estados Unidos y otros países.&lt;br /&gt;
&lt;br /&gt;
Estos módulos tienen 3 pines:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Vcc, que debe ser alimentado con 5V, por lo que deberá conectarse al pin de 5V de Arduino.&lt;/li&gt;
&lt;li&gt;GND, que debe conectarse a cualquier pin GND de nuestro Arduino.&lt;/li&gt;
&lt;li&gt;DATA, que será el pin a través del cual enviaremos o recibiremos los datos.&lt;/li&gt;
&lt;/ol&gt;
Existe en ambos módulos un pad donde podremos soldar una antena apropiada, para aumentar así el alcance de los módulos. El tipo de antena más simple que podemos utilizar es un trozo de cable recto de aproximadamente unos 16 centímetros y medio (en caso de que sean módulos de 433 MHz). En esta imagen podéis apreciar otros tipos de antena:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj77OZILYKFouk7dcqMoqBhBb0E-kC5Gr1nrO8xsIEDbVRmCU48CjiHpWWo1KRLlzBK4n3pcD6w2XAVKuSHGqVc2EUJS-zTvcxTLkbs55k1poyoFJkVwkXBjPYWm-MQtNW0QwzKeNnz3T35/s1600/antena-tx-rx-433mhz.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj77OZILYKFouk7dcqMoqBhBb0E-kC5Gr1nrO8xsIEDbVRmCU48CjiHpWWo1KRLlzBK4n3pcD6w2XAVKuSHGqVc2EUJS-zTvcxTLkbs55k1poyoFJkVwkXBjPYWm-MQtNW0QwzKeNnz3T35/s1600/antena-tx-rx-433mhz.jpg&quot; height=&quot;265&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
El módulo de envío no tiene mucho misterio y sólo hay que alternar el pin de datos entre 0 y 1, dejando una pausa determinada entre las transiciones del pin. Es muy recomendable que los bits de los datos a enviar se representen con varias transiciones entre cero y uno, por ejemplo aquí podemos ver una codificación bastante típica:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi41RzgxKPBC4rjiwwrhuYCNfqXYnqifGvyE9N1dC-Xt1Kug4ew3Tv47hi25wlP1I4_H9JxuPioFgJtm3uW1m2e6wbYTgRtIZdZ1bXdRIdJsCTOMKpEv4t-VSCXR-2ZS4tQMN7UJnl5hRPu/s1600/CerosYUnos.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi41RzgxKPBC4rjiwwrhuYCNfqXYnqifGvyE9N1dC-Xt1Kug4ew3Tv47hi25wlP1I4_H9JxuPioFgJtm3uW1m2e6wbYTgRtIZdZ1bXdRIdJsCTOMKpEv4t-VSCXR-2ZS4tQMN7UJnl5hRPu/s1600/CerosYUnos.png&quot; height=&quot;100&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Se observa como un valor se representa mediante un pulso corto seguido de otro pulso largo, mientras que el otro valor se representa con dos pulsos cortos seguidos.&lt;br /&gt;
&lt;br /&gt;
El módulo de recepción sí que tiene más miga, puesto que estos aparatos no traen circuitería de filtrado y las bandas de frecuencia libres como la de 433 MHz están llenas de ruido, por lo que cuando no estemos transmitiendo nada, recibiremos gran cantidad de transiciones entre cero y uno en el pin de datos, las cuales son erráticas y no siguen ningún patrón aparente, como podéis comprobar en esta imagen:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFH_fIbVEzEEcV7hYXBkd0XQx7ZrtJU9PYQFF4Q6VaKQofr6mBroh0ISvn5EKaS272MOZcjAO664PDyZR5W9P_lo1QLT30rsKZaOZQ_6a4TDMqnsHPRJQKxE1H23KcxDdy2r5xxjbvrnGa/s1600/EnVacio.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFH_fIbVEzEEcV7hYXBkd0XQx7ZrtJU9PYQFF4Q6VaKQofr6mBroh0ISvn5EKaS272MOZcjAO664PDyZR5W9P_lo1QLT30rsKZaOZQ_6a4TDMqnsHPRJQKxE1H23KcxDdy2r5xxjbvrnGa/s1600/EnVacio.png&quot; height=&quot;122&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Se ve claramente y a simple vista la diferencia entre los periodos donde se está transmitiendo información y los tramos donde sólo hay ruido, pero esto complica un poco la discriminación que deberemos realizar nosotros por software para filtrar todo aquello no deseado.&lt;br /&gt;
&lt;br /&gt;
Lo más sencillo para manejar un receptor de este tipo es declarar una interrupción y conectar el pin de datos del módulo RF al pin correspondiente del arduino (D2 o D3, dependiendo de la interrupción declarada). De este modo, sólo tendremos que medir el tiempo transcurrido entre las transiciones para saber si se ajusta a nuestro patrón o no.&lt;br /&gt;
&lt;br /&gt;
Los pros de este sistema os los podéis imaginar: un precio realmente bajo con un alcance considerable (con la antena adecuada he alcanzado sin problemas distancias de unos 100 metros a campo abierto). Las pegas, sin embargo, son importantes, porque por un lado necesitaremos 2 módulos (uno de envío y uno de recepción en cada arduino, salvo que queramos comunicación en un único sentido) y, por otra parte, no se consiguen buenas tasas de transferencia de datos, además del mayor &quot;coste&quot; en términos de programación que requieren estos módulos debido a tener que controlar los errores, el reenvío de paquetes perdidos o erróneos, etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
Módulos Nordic RF&lt;/h3&gt;
Hace tiempo, investigando una alternativa intermedia entre los Zigbee y los módulos OOK que comentamos anteriormente, di con estos transceptores poco conocidos y que tenían un precio atractivo, por lo que decidí comprar un par para probarlos y ver su desempeño.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFxaN954BqvB-BtkHGp9feql7lQQbVD03PvHqJiNk7JaRPf9wPgvLfhddrUnCOqne8bndmE7uzy_wFkf1-wFVAAIKQI1_O_qoOLC0wdkpuKabndTrjiB3JcRHrcOXqrrvWlQIu8TCSErU-/s1600/nrf24l01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFxaN954BqvB-BtkHGp9feql7lQQbVD03PvHqJiNk7JaRPf9wPgvLfhddrUnCOqne8bndmE7uzy_wFkf1-wFVAAIKQI1_O_qoOLC0wdkpuKabndTrjiB3JcRHrcOXqrrvWlQIu8TCSErU-/s1600/nrf24l01.jpg&quot; height=&quot;271&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
Este modelo concreto es el NRF24L01 y dispone de una librería para Arduino que podemos usar en nuestros desarrollos: &lt;a href=&quot;http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01&quot;&gt;http://playground.arduino.cc/InterfacingWithHardware/Nrf24L01&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
La comunicación con estos módulos se realiza mediante SPI, por lo que deberemos conectarlo a los pines SCK, MISO y MOSI de nuestro arduino preferido (pines 13, 12 y 11) y dos pines digitales de I/O (por defecto, la librería utiliza los pines D7 y D8), además de alimentación (3.3V). En esta imagen podéis ver el esquema de conexionado:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_XfVhmgVPcDzd87_oEOQlFVvMP2DXj4600M9g0DTxYx2AHvzH02qvX7iBb7LcNm1zhDSBw8ZQhVz7zBtuXmmMoy6tABP5hLZy5g121eHolV3ytLmiTNQT0mqqTfwMlRBcx1RwMXbGjFRp/s1600/Pinout_con_IRQ.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_XfVhmgVPcDzd87_oEOQlFVvMP2DXj4600M9g0DTxYx2AHvzH02qvX7iBb7LcNm1zhDSBw8ZQhVz7zBtuXmmMoy6tABP5hLZy5g121eHolV3ytLmiTNQT0mqqTfwMlRBcx1RwMXbGjFRp/s1600/Pinout_con_IRQ.jpg&quot; height=&quot;348&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Antes de poder conectar el módulo RF a una protoboard para poder hacer las primeras pruebas, deberemos construir un pequeño adaptador con un par de tiras de pines y un trozo de pcb perforada, ya que estos módulos utilizan como conexionado dos tiras de 5 pines en paralelo. En esta foto podéis ver uno de mis módulos y el adaptador que construí:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtDWkkppXYlcFLF3eI931IUHoWj-4Mj9RJ-V1UYdGjmSPT4KEqQaxW0dpXII08ssSRemea00xB4VSXt26N-M4wEzDAD7-4tOsfmEZsjro8kqRxUa140v-S6zbgjFcGDi7mQgiYC4d6aNRW/s1600/Img_3943.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtDWkkppXYlcFLF3eI931IUHoWj-4Mj9RJ-V1UYdGjmSPT4KEqQaxW0dpXII08ssSRemea00xB4VSXt26N-M4wEzDAD7-4tOsfmEZsjro8kqRxUa140v-S6zbgjFcGDi7mQgiYC4d6aNRW/s1600/Img_3943.jpg&quot; height=&quot;232&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Por ahora, no he tenido la oportunidad de usar estos módulos en una aplicación real, simplemente he cargado los sketches de ejemplo de la librería y los he probado. Tan pronto como pueda ponerlos a prueba y realice algunas mediciones de distancia, velocidad, etc. publicaré aquí los resultados.&lt;br /&gt;
&lt;br /&gt;
¡Hasta la próxima!&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/7699816432511595444/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2014/07/comunicacion-inalambrica-con-arduino.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7699816432511595444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7699816432511595444'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2014/07/comunicacion-inalambrica-con-arduino.html' title='Comunicación inalámbrica con Arduino'/><author><name>Cucaracha</name><uri>http://www.blogger.com/profile/09597656516638285285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOY7oiND29NzKUfQ4jFJ79VVl2IIzUI7GqLhH-kMxzrSyXSryuJkvV7LY4d18ptradXFPKnHj9DijfaORBYPjcbLCbGeed4EFdluJk9UUeVV1SuCf38rRSHSt8LMvtyS2egjkhAFOfK0UE/s72-c/xbee.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-5288861517777772770</id><published>2012-02-18T15:43:00.014-08:00</published><updated>2012-02-21T14:58:44.222-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino standalone"/><category scheme="http://www.blogger.com/atom/ns#" term="atmega328"/><category scheme="http://www.blogger.com/atom/ns#" term="atmega328 standalone"/><category scheme="http://www.blogger.com/atom/ns#" term="standalone"/><title type='text'>Arduino Standalone</title><content type='html'>O lo que es lo mismo, hacer funcionar el atmega328 sin necesidad de la placa del arduino.&lt;br /&gt;&lt;br /&gt;Razón de hacer esto: &lt;br /&gt;- ahorro de espacio &lt;br /&gt;- el atmega por separado es mucho más barato&lt;br /&gt;- para proyectos dedicados no merece la pena perder una placa arduino&lt;br /&gt;&lt;br /&gt;Tras una larga tarde buscando por internet como iban las conexiones, he conseguido hacer que funcione el ejemplo de blink y ha quedado así&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimv2R5LBC3NaFQYb4a1z4arlscpZYLuxfmjCIZjoUZMwo1x8Px3-sPWlvYXfvUlSTLS4KDVfqwJv_ZRCP3rS9N-opM2NkxLcfLS40v6xU37DecYUaUTtDMQYTp-L542K49k-tpCQMtiHg/s1600/2012-02-18+16.04.58.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 150px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimv2R5LBC3NaFQYb4a1z4arlscpZYLuxfmjCIZjoUZMwo1x8Px3-sPWlvYXfvUlSTLS4KDVfqwJv_ZRCP3rS9N-opM2NkxLcfLS40v6xU37DecYUaUTtDMQYTp-L542K49k-tpCQMtiHg/s200/2012-02-18+16.04.58.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710631910179646082&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuN0i6KpHYvYbjFa9_kVHWOgsUB0roYJf1GBPNbd8NgW5_sG0ucIvK3TMPQKBC4QZtiOs9yGGUKnBIFli4sDlm71DfNkxrKaqNfmpviTzCM25QXV-Z2iKwKBPiNf_GB3Ob8sZt8owk0y4/s1600/2012-02-18+15.58.48.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 150px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuN0i6KpHYvYbjFa9_kVHWOgsUB0roYJf1GBPNbd8NgW5_sG0ucIvK3TMPQKBC4QZtiOs9yGGUKnBIFli4sDlm71DfNkxrKaqNfmpviTzCM25QXV-Z2iKwKBPiNf_GB3Ob8sZt8owk0y4/s200/2012-02-18+15.58.48.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710631898124939330&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Ingredientes necesarios:&lt;br /&gt;&lt;br /&gt;1x Atmega328&lt;br /&gt;1x 16MHz clock crystal&lt;br /&gt;2x 22 pF capacitors&lt;br /&gt;cable y alimentación a 5v&lt;br /&gt;&lt;br /&gt;En el caso que tengas que alimentarlo con un voltaje mayor de 5v necesitarás un &lt;br /&gt;&lt;br /&gt;1x L7805CV  (este sirve para pasar un voltaje de entrada de hasta 40v a 5v para la alimentación del atmega, ojo que debe ser mínimo 7 u 8v)&lt;br /&gt;&lt;br /&gt;OJO. He puesto en el dibujo 2 pilas AA pero sólo para indicar como va la entrada de corriente, que debe ser 5v, el dibujo es orientativo &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9eXTQJ8lBIuYyg8QaT1RiXGk6kndGF_xh5OG_ceq9sGcOnkc0Pv2maCaGKjFlaLpC3WffM76Zebg0U8XAAYfwDW9dfoDynIzZ_A8qxpO5diY-XiBJPRLX-a0dwNZjSYK7IMZNRIaNDeE/s1600/Untitled+Sketch+2_bb.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 383px; height: 309px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9eXTQJ8lBIuYyg8QaT1RiXGk6kndGF_xh5OG_ceq9sGcOnkc0Pv2maCaGKjFlaLpC3WffM76Zebg0U8XAAYfwDW9dfoDynIzZ_A8qxpO5diY-XiBJPRLX-a0dwNZjSYK7IMZNRIaNDeE/s400/Untitled+Sketch+2_bb.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710867142741228562&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Esto es lo mínimo que se puede poner, después ya te apañas tu para ponerle lo que necesites, si no te sabes de memoria que es cada patilla, puedes fijarte aquí&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmj9VsdYxipEv7GvBeaouwtsbmngoVp_yKflT4BHyiHDaAVFvtoX61yOXNzVxxEW4w_Siph3Ivdx6x1NMWR01dvMnd0Ip2q-c8yLjmBx0rVkawvJc5Vz8CxqOGA2-m8Wr7ApZ9jAtnqRU/s1600/Arduino-To-Atmega8-Pins.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 260px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmj9VsdYxipEv7GvBeaouwtsbmngoVp_yKflT4BHyiHDaAVFvtoX61yOXNzVxxEW4w_Siph3Ivdx6x1NMWR01dvMnd0Ip2q-c8yLjmBx0rVkawvJc5Vz8CxqOGA2-m8Wr7ApZ9jAtnqRU/s400/Arduino-To-Atmega8-Pins.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710870355377545458&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Y después de ponerle algo útil. Tenemos nuestro atmega funcionando&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZEpyHcMIw7t0CPPrUt3qjpWzy_6i6JwgZpC4yR36L2vOBeQ4F9X1aMjUEmHzLonVsz4Og5v62tIKvibAbX07X1TrmXGnwXMZOHkZn3EisYPUWPc0afcW2nAFVgtE77BkUjfqRWjqZZug/s1600/2012-02-18+18.55.04.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 300px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZEpyHcMIw7t0CPPrUt3qjpWzy_6i6JwgZpC4yR36L2vOBeQ4F9X1aMjUEmHzLonVsz4Og5v62tIKvibAbX07X1TrmXGnwXMZOHkZn3EisYPUWPc0afcW2nAFVgtE77BkUjfqRWjqZZug/s400/2012-02-18+18.55.04.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710867536084803426&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Si queremos programar el Atmega sin tener que sacarlo y ponerlo en la placa de arduino debemos hacer la siguiente conexión:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcI1MSdJxL78RHTZyFUyHrOgwjjhiKn9gqoy_53oVzlxcY0J18W3IqGL686BqzQrWnndjc5cZFLLJJ8XJvOFTpJGoEpozrwndPr6DpagKpmVQOdPXJdyzL07fyFrF1y-DVi058eJqg-zk/s1600/Untitled+Sketch+2_bb.png&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 371px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcI1MSdJxL78RHTZyFUyHrOgwjjhiKn9gqoy_53oVzlxcY0J18W3IqGL686BqzQrWnndjc5cZFLLJJ8XJvOFTpJGoEpozrwndPr6DpagKpmVQOdPXJdyzL07fyFrF1y-DVi058eJqg-zk/s400/Untitled+Sketch+2_bb.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5710869617078436498&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Y ya tenemos el primer paso hecho hacia el siguiente proyecto...</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/5288861517777772770/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2012/02/arduino-standalone.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/5288861517777772770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/5288861517777772770'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2012/02/arduino-standalone.html' title='Arduino Standalone'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimv2R5LBC3NaFQYb4a1z4arlscpZYLuxfmjCIZjoUZMwo1x8Px3-sPWlvYXfvUlSTLS4KDVfqwJv_ZRCP3rS9N-opM2NkxLcfLS40v6xU37DecYUaUTtDMQYTp-L542K49k-tpCQMtiHg/s72-c/2012-02-18+16.04.58.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-1363946103247315321</id><published>2012-02-15T07:48:00.007-08:00</published><updated>2012-02-15T07:59:08.684-08:00</updated><title type='text'>Comenzando con IR (recepción de datos)</title><content type='html'>Bueno, dada la pereza, haré un breve pero interesante documento sobre lo que llevo hecho. La intención del proyecto es poder controlar cosas con IR así que esta es la primera parte, entender los datos.&lt;br /&gt;&lt;br /&gt;Como emisor, usaré un mando a distancia cualquiera. Ya haré otra publicación sobre como hacer uno propio.&lt;br /&gt;&lt;br /&gt;Parte del receptor:&lt;br /&gt;&lt;br /&gt;He usado un receptor IR que tenía por ahi perdido, pero básicamente todos los receptores tienen 3 pines, uno para la entrada de 5v, otro para la tierra y otro para los datos.&lt;br /&gt;&lt;br /&gt;Los 5v y tierra los conectamos a arduino, y el de datos lo conectamos al pin2 de los digitales.&lt;br /&gt;&lt;br /&gt;En mi ejemplo he puesto que arduino, según lo leido por IR , controle un led bicolor y los he conectado a los pines 8 y 9&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToBgJG71aiTZaP5qLXcWUAKJ-1_qv7Gkm-agrkCNFsvTJdvm7ywyLN3Wv8wem6dxYLBbeVr3SDENgl_GSf9QHstgWPw2WSrOV35-BAaYDVHxm6wS0AipC5-_FSuggO7SPdS7LkoIu96I/s1600/2012-02-15+16.47.02.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToBgJG71aiTZaP5qLXcWUAKJ-1_qv7Gkm-agrkCNFsvTJdvm7ywyLN3Wv8wem6dxYLBbeVr3SDENgl_GSf9QHstgWPw2WSrOV35-BAaYDVHxm6wS0AipC5-_FSuggO7SPdS7LkoIu96I/s320/2012-02-15+16.47.02.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5709391276694083714&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfCBy4abJb0jboDSINrtU0AxjG64IQ-Zbl8MyoL3QP54Y0ET7PSsQ2fr5xk_pABl_UvXWEm29Kl5wQoVnTKGj4a57t9eMMI7Mpz-ChRp9cBmaZiUVSMLQpUtcaRybjHb-AblaKNLf5B0M/s1600/2012-02-15+16.47.28.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 240px; height: 320px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfCBy4abJb0jboDSINrtU0AxjG64IQ-Zbl8MyoL3QP54Y0ET7PSsQ2fr5xk_pABl_UvXWEm29Kl5wQoVnTKGj4a57t9eMMI7Mpz-ChRp9cBmaZiUVSMLQpUtcaRybjHb-AblaKNLf5B0M/s320/2012-02-15+16.47.28.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5709391541267356978&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;En cuanto al código, me he copiado descaradamente de esta web &lt;a href=&quot;http://www.ladyada.net/learn/sensors/ir.html&quot;&gt;http://www.ladyada.net/learn/sensors/ir.html&lt;/a&gt;, en la cual aparece muy claramente una explicación y el código.</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/1363946103247315321/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2012/02/comenzando-con-ir-recepcion-de-datos.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/1363946103247315321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/1363946103247315321'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2012/02/comenzando-con-ir-recepcion-de-datos.html' title='Comenzando con IR (recepción de datos)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToBgJG71aiTZaP5qLXcWUAKJ-1_qv7Gkm-agrkCNFsvTJdvm7ywyLN3Wv8wem6dxYLBbeVr3SDENgl_GSf9QHstgWPw2WSrOV35-BAaYDVHxm6wS0AipC5-_FSuggO7SPdS7LkoIu96I/s72-c/2012-02-15+16.47.02.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-2712030685375181706</id><published>2011-07-24T11:35:00.000-07:00</published><updated>2011-07-24T11:35:08.571-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="analógica"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="inductancias"/><title type='text'>Midiendo inductancias con Arduino</title><content type='html'>Cuando estas trasteando y aprendiendo en el mundo de la electrónica siempre es interesante mirar circuitos que otras personas han diseñado y probado para realizar funciones específicas que necesitas. Es simple, te bajas el esquema, te haces con los componentes y los sueldas en una placa perfboard o te haces tu propio PCB.&lt;br /&gt;
&lt;br /&gt;
Pero hay un problema que siempre se me presenta con un circuito analógico medianamente complicado, y es ¿y como cojones se que inductancia tiene esta bobina?&lt;br /&gt;
&lt;br /&gt;
Pues bien, &lt;a href=&quot;http://dangerousprototypes.com/2011/07/21/easily-measure-inductance-using-arduino/&quot;&gt;acabo de ver en dangerous prototypes&lt;/a&gt; un &lt;a href=&quot;http://reibot.org/2011/07/19/measuring-inductance/&quot;&gt;método&lt;/a&gt; súper sencillo para medir inductancias usando arduino, echadle un vistazo y si alguno lo prueba, me contáis.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://dangerousprototypes.com/wp-content/media/2011/07/lm339-600x255.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://dangerousprototypes.com/wp-content/media/2011/07/lm339-600x255.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/2712030685375181706/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2011/07/midiendo-inductancias-con-arduino.html#comment-form' title='8 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2712030685375181706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2712030685375181706'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2011/07/midiendo-inductancias-con-arduino.html' title='Midiendo inductancias con Arduino'/><author><name>n0p</name><uri>http://www.blogger.com/profile/12938023970405908606</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img136.imageshack.us/img136/5333/photoja0.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-9015092741311486612</id><published>2011-02-02T00:59:00.000-08:00</published><updated>2011-02-02T01:28:01.968-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="documental"/><category scheme="http://www.blogger.com/atom/ns#" term="historia"/><title type='text'>Arduino: The Documentary</title><content type='html'>Para los fans de este maravilloso proyecto que es Arduino, aquí os dejo un excelente documental realizado por LABoral Centro de Arte y Creación Industrial (&lt;a href=&quot;http://www.laboralcentrodearte.org/&quot;&gt;link&lt;/a&gt;) y filmado en Madrid, Gijón y Nueva York, que muestra los comienzos y la historia de este peculiar proyecto que cambió todos los esquemas en el mundo de la electrónica para aficionados (y no tan aficionados).&lt;br /&gt;&lt;br /&gt;Aquí os dejo el trailer de &lt;span style=&quot;font-style: italic;&quot;&gt;Arduino: The Documentary&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;iframe src=&quot;http://player.vimeo.com/video/13781339?byline=0&quot; frameborder=&quot;0&quot; height=&quot;225&quot; width=&quot;400&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Podéis encontrar el documental completo en su web: &lt;a href=&quot;http://arduinothedocumentary.org/&quot;&gt;http://arduinothedocumentary.org/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/9015092741311486612/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2011/02/arduino-documentary.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/9015092741311486612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/9015092741311486612'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2011/02/arduino-documentary.html' title='Arduino: The Documentary'/><author><name>Cucaracha</name><uri>http://www.blogger.com/profile/09597656516638285285</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-7621582234678161269</id><published>2011-01-01T11:09:00.000-08:00</published><updated>2011-01-01T11:09:21.784-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><title type='text'>Eclipse + avr-gcc + avrdude</title><content type='html'>Si estais hasta los mismísimos del cutreIDE de arduino, existe una solución perfecta!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://avr-eclipse.sf.net&quot;&gt;AVR-Eclipse&lt;br /&gt;
&lt;/a&gt;&lt;br /&gt;
Es un plugin de eclipse que extiende CDT (el componente de C/C++) y te integra avr-gcc (el compilador libre, el mismo que usa arduino), avrdude (para programar el chip, soporta tb el bootloader de arduino) y eclipse, el IDE de programación preferido por los niños&lt;br /&gt;
&lt;br /&gt;
Para rematar el conjunto, podéis incorporar las librerias arduino a vuestros proyectos escritos en C, pero esto ya lo dejo para otro post :P</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/7621582234678161269/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2011/01/eclipse-avr-gcc-avrdude.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7621582234678161269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7621582234678161269'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2011/01/eclipse-avr-gcc-avrdude.html' title='Eclipse + avr-gcc + avrdude'/><author><name>n0p</name><uri>http://www.blogger.com/profile/12938023970405908606</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://img136.imageshack.us/img136/5333/photoja0.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-6864785672583277509</id><published>2010-12-27T04:31:00.000-08:00</published><updated>2010-12-27T04:44:06.914-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="alarma"/><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="iniciación"/><category scheme="http://www.blogger.com/atom/ns#" term="tilt"/><title type='text'>Pequeña alarma anti-robo</title><content type='html'>Hi again :)&lt;br /&gt;&lt;br /&gt;Hoy volveremos a hacer un proyecto sencillo, pero resultón ;) Una sencilla alarma anti-robo, haciendo uso de un tilt sensor, es decir, un sensor de inclinación/vibración/movimiento... Este sensor, se comporta a efectos prácticos como un botón normal y corriente (ON/OFF).&lt;br /&gt;&lt;br /&gt;Lo montaremos con ayuda de nuestra protoboard, de forma que cuando alguien mueva la protoboard, un LED se iluminará y un zumbador hará ruido. Para este proyecto necesitaremos:&lt;br /&gt;&lt;br /&gt;     - 1 tilt sensor.&lt;br /&gt;     - 1 resistencia de 10k Ohms.&lt;br /&gt;- 1 zumbador piezo.&lt;br /&gt;- 1 LED.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;El circuito, que es bastante simple, se puede ver en la siguiente imagen:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg69Z1e94P6NWmTtAORgi5uqUoJjKq7amY0SdQxMsVQFE3MT00UIShVKWBSlL4r3ry_ZgdKF35geauSTrXOfKdBalPH9lMJB2nbdzmfUG_qYoUSNlbhKm6VmAFfWd-ytI9YlmZOlp0df5Y/s1600/TiltSensor2.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg69Z1e94P6NWmTtAORgi5uqUoJjKq7amY0SdQxMsVQFE3MT00UIShVKWBSlL4r3ry_ZgdKF35geauSTrXOfKdBalPH9lMJB2nbdzmfUG_qYoUSNlbhKm6VmAFfWd-ytI9YlmZOlp0df5Y/s320/TiltSensor2.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5555339009682681154&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Como vemos, hemos conectado el tilt sensor al pin 2, y el buzzer al 7.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;El código que hemos usado es el siguiente:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int ledPin = 13;                    // PIN del LED&lt;br /&gt;int inPin = 2;                      // PIN del pulsador&lt;br /&gt;int value = 0;                      // Valor del pulsador&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;&lt;br /&gt;pinMode(ledPin, OUTPUT);          // Inicializa el pin 13 como salida digital&lt;br /&gt;pinMode(inPin, INPUT);            // Inicializa el pin 2 como entrada digital&lt;br /&gt;Serial.begin(9600);               // use the serial port&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;&lt;br /&gt;value = digitalRead(inPin);       // Lee el valor de la entrada digital&lt;br /&gt;&lt;br /&gt;if (digitalRead(inPin) == 1) {&lt;br /&gt; value = 0;&lt;br /&gt; noTone(7);&lt;br /&gt;}&lt;br /&gt;else {&lt;br /&gt; value = 1;&lt;br /&gt; tone(7, 150, 500);&lt;br /&gt;}&lt;br /&gt;digitalWrite(ledPin, value);&lt;br /&gt;Serial.println(value);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;El pequeño “arreglo” que hemos hecho en el&lt;span style=&quot;font-style: italic;&quot;&gt; loop&lt;/span&gt;, poniendo &lt;span style=&quot;font-style: italic;&quot;&gt;value&lt;/span&gt; a 0 cuando por el pin 2 se lee 1, y poniéndolo a 1 cuando se lee 0, es porque así el LED estará apagado en estado de reposo.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;El resultado, una vez conectado todo y habiendo subido el programa al Arduino, se puede ver en el siguiente vídeo (por cierto, comentar que mi tilt sensor está un poco suelto, ya que las patillas son demasiado cortas, y no me apetecía ponerle alargadores, por eso lo aprieto contra la protoboard cuando levanto todo ;)):&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/OMXSMKmuWeY?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/OMXSMKmuWeY?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Y esto ha sido todo. Espero que os haya gustado.&lt;br /&gt;&lt;br /&gt;Un saludo :)</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/6864785672583277509/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/pequena-alarma-anti-robo.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6864785672583277509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6864785672583277509'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/pequena-alarma-anti-robo.html' title='Pequeña alarma anti-robo'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg69Z1e94P6NWmTtAORgi5uqUoJjKq7amY0SdQxMsVQFE3MT00UIShVKWBSlL4r3ry_ZgdKF35geauSTrXOfKdBalPH9lMJB2nbdzmfUG_qYoUSNlbhKm6VmAFfWd-ytI9YlmZOlp0df5Y/s72-c/TiltSensor2.JPG" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-6689128491654798782</id><published>2010-12-26T10:09:00.000-08:00</published><updated>2010-12-26T10:30:46.303-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="iniciación"/><category scheme="http://www.blogger.com/atom/ns#" term="led"/><title type='text'>Controlando la intensidad de un LED</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:hyphenationzone&gt;21&lt;/w:HyphenationZone&gt;   &lt;w:donotoptimizeforbrowser/&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;Hola de nuevo &lt;span style=&quot;font-family:Wingdings;&quot;&gt;&lt;span style=&quot;&quot;&gt;:)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Siguiendo con nuestros proyectos para principiantes, a continuación veremos dos que nos permitirán controlar la intensidad de un LED (y ver los datos resultantes también en el Serial Monitor). Empecemos...&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p style=&quot;font-weight: bold;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Control de intensidad de un LED con un potenciómetro&lt;/span&gt;&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;En este sencillo proyecto controlaremos la intensidad de un diodo LED mediante un potenciómetro que usaremos como manivela. Necesitaremos:&lt;/p&gt;      &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 53.25pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 LED.&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 53.25pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 potenciómetro.&lt;br /&gt;&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;Conectaremos una de las patillas del potenciómetro que van juntas (hay dos en un lado y una sola en el otro) a tierra (negativo), y la otra a 5V (positivo). La patilla que va sola en su lado, la conectaremos al pin analógico (A0) de Arduino.&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;Por otra parte, conectaremos el negativo del LED a tierra, y el positivo al pin digital 9 de Arduino.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;El resultado, con la ayuda de nuestra protoboard, es el siguiente:&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwTXJfs6ITdOTxFxS8-oLfO-5kDGFxzKKWgAeTA5YPOSORctDRaWUesOtYTUwKYs4lOZblbld5prCf0JZP4MiFClZ6wXvaKHvIJ4MTgr3my2IfrNFUSioTGIAeodXXJl372UxzCXuFaxA/s1600/Knob_LED.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwTXJfs6ITdOTxFxS8-oLfO-5kDGFxzKKWgAeTA5YPOSORctDRaWUesOtYTUwKYs4lOZblbld5prCf0JZP4MiFClZ6wXvaKHvIJ4MTgr3my2IfrNFUSioTGIAeodXXJl372UxzCXuFaxA/s320/Knob_LED.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5555055210242094930&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;El código que hará que podamos controlar la intensidad con el potenciómetro se expone a continuación:&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;int knobValue, fadeValue;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void setup()&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// initialize the serial port&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;Serial.begin(9600);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void loop()&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// read the value from the input&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;knobValue = analogRead(knobPin);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// remap the values from 10 bit input to 8 bit output&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;fadeValue = map(knobValue, 0, 1023, 0 , 254);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// use the input value to fade the led&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;analogWrite(ledPin, fadeValue);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// print the input value to the serial port for debugging&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;Serial.println(fadeValue);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;}&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;   &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Como veis es muy simple. El resultado se puede ver en este vídeo:&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/zhNm0w5-Ng4?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/zhNm0w5-Ng4?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p style=&quot;font-weight: bold;&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;Control de intensidad de un LED con un botón&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Ahora vamos a controlar la intensidad del LED mediante un botón. Cuando se pulsa el botón, la intensidad del LED va aumentando, y cuando se suelta, va disminuyendo.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Necesitaremos:&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 53.25pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 LED.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 53.25pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 botón.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 53.25pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 resistencia de 10k Ohms.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Conectaremos los componentes del siguiente modo:&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot; style=&quot;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJHzN2Ib1M75j_QfHRgbwLLy5MmGuULwQPHu4VBUqfxesf_xaFArYlyazMTPkVUf6dpXVL3AsZ0IghXAyl2ZTXQxO8PIG9k30FC8-4SVBakJQo2SkqNnxK5OcR1JrELQboMhQYpjuJH6Q/s1600/Button_LED.jpg&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJHzN2Ib1M75j_QfHRgbwLLy5MmGuULwQPHu4VBUqfxesf_xaFArYlyazMTPkVUf6dpXVL3AsZ0IghXAyl2ZTXQxO8PIG9k30FC8-4SVBakJQo2SkqNnxK5OcR1JrELQboMhQYpjuJH6Q/s320/Button_LED.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5555057436673566290&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;   &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Como se puede ver, usamos el pin digital 8 con el botón, y el 9 con el LED. &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;El código que hemos empleado es el siguiente:&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;   &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const int fadeTimerFreq = 30;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// fadeTime is the total time it will take to complete the ease (in milliseconds)&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const int fadeTime = 3000;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// &lt;&lt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// additional variable for the timer&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;int currentTime, fadeTimerLast;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// these constant variables store the pin numbers&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const int ledPin = 9;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const int buttonPin = 8;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const int fadeRange = 254;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// the amount to step the fade; must be between 1 and the fadeRange&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;const float fadeStep = (float(fadeTimerFreq) / (fadeTime)) * fadeRange;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;int buttonValue, fadeTarget, fadeValueTweened;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;float fadeValue;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void setup()&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// initialize the serial port; needed for debugging below&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;Serial.begin(9600);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// initialize the LED pin&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;pinMode(ledPin, OUTPUT);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// initialize the input pin&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;pinMode(buttonPin, INPUT);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void loop()&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;{&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// for all timers&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;currentTime = millis();&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// checks to see if the number of milliseconds has passed&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;if ( abs(currentTime - fadeTimerLast) &gt;= fadeTimerFreq) {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;&lt;/span&gt;fadeTimerLast = currentTime;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// read the value from the input&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;buttonValue = digitalRead(buttonPin);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// step the fading&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;if(buttonValue == 1){&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;      &lt;/span&gt;// if the button is pressed, increase the fade&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;      &lt;/span&gt;fadeValue = fadeValue + fadeStep;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;else{&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;      &lt;/span&gt;// if the button is not pressed, decrease the fade&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;      &lt;/span&gt;fadeValue = fadeValue - fadeStep;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// constrain the fadeValue so it can&#39;t go off toward infinity&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;fadeValue = constrain(fadeValue, 0, fadeRange);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// get the tweened value -- i.e. the smooth value&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;fadeValueTweened = Quad_easeInOut(fadeValue, 0, fadeRange);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// use the tweened value to set the brightness of the LED&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;analogWrite(ledPin, fadeValueTweened);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;// print the values to the serial port for debugging&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Serial.print(buttonValue);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Serial.print(&quot;, &quot;);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;    &lt;/span&gt;Serial.println(fadeValue);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// Quad easing thanks to Robert Penner&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;// variables used are type &quot;float&quot; so that you can throw smaller numbers at it and it will //still work well&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;float Quad_easeInOut(float t, float fixedScaleStart, float fixedScaleEnd){&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// float b = 0, c = 1, d = 1;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;float b = fixedScaleStart;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;float c = fixedScaleEnd - fixedScaleStart;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;float d = fixedScaleEnd;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;if ((t/=d/2) &lt;&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;return -c/2 * ((--t)*(t-2) - 1) + b;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;}&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;El resultado se puede ver aqu&lt;/span&gt;&lt;span style=&quot;font-family:Symbol;&quot;&gt;í&lt;/span&gt;&lt;span style=&quot;&quot;&gt;:&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/EoUML4qZgy4?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/EoUML4qZgy4?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Y... eso es todo :)&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;Un saludo.&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/6689128491654798782/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/controlando-la-intensidad-de-un-led.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6689128491654798782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6689128491654798782'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/controlando-la-intensidad-de-un-led.html' title='Controlando la intensidad de un LED'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwTXJfs6ITdOTxFxS8-oLfO-5kDGFxzKKWgAeTA5YPOSORctDRaWUesOtYTUwKYs4lOZblbld5prCf0JZP4MiFClZ6wXvaKHvIJ4MTgr3my2IfrNFUSioTGIAeodXXJl372UxzCXuFaxA/s72-c/Knob_LED.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-81119686712997143</id><published>2010-12-25T11:18:00.001-08:00</published><updated>2010-12-26T04:54:52.301-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="iniciación"/><category scheme="http://www.blogger.com/atom/ns#" term="sensor"/><category scheme="http://www.blogger.com/atom/ns#" term="temperatura"/><title type='text'>Sensor de temperatura</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:hyphenationzone&gt;21&lt;/w:HyphenationZone&gt;   &lt;w:donotoptimizeforbrowser/&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Siguiendo con los proyectos sencillos, vamos a ver cómo podemos hacer con Arduino un sensor de temperatura simple, que puede servirnos para algo tan útil como una alarma anti-incendios =) Lo que hará esta alarma será iluminar un LED y hacer que suene un pitido cuando la temperatura sea superior a la que nosotros consideremos como “peligrosa”. Si la temperatura vuelve a un nivel aceptable, la alarma para. Además, se irá mostrando por el Serial Monitor (Tools-&gt;Serial Monitor) la temperatura actual que se va detectando.&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;Para realizar este proyecto hemos utilizado lo siguiente:&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 buzzer piezo.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 termistor de 4.7k.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 resistencia de 220 Ohms.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot; style=&quot;margin-left: 36pt; text-indent: -18pt;&quot;&gt;-&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;         &lt;/span&gt;1 resistencia de 10k Ohms.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Lo primero que haremos será conectar un LED en el pin 13 de Arduino (tal y como vimos en el proyecto &lt;i&gt;Blink&lt;/i&gt; del post anterior).&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;Seguidamente, conectaremos el buzzer a tierra y al pin digital 7 (puede ser otro, sin problema ;)), y usaremos la resistencia de 220 Ohms..&lt;/p&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;Por último haremos uso del termistor y la resistencia que nos queda, conectándolos del siguiente modo:&lt;/p&gt;    &lt;pre&gt;(Tierra) --- (R 10k) ------|------ (Termistor) --- (+5v)&lt;span style=&quot;&quot;&gt;&lt;br /&gt;                           |&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;&quot;&gt;       &lt;/span&gt;&lt;span style=&quot;&quot;&gt;           &lt;/span&gt;Entrada Analógica 0 (A0)&lt;/pre&gt;    &lt;p class=&quot;MsoNormal&quot;&gt;El circuito, una vez montado (ayudándonos de una protoboard), quedaría así:&lt;/p&gt;&lt;pre&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihfmO8Mr4mFrKHqrbmTSVD5ecGMp9aw9DWYChCTQYOScKNXvWWx2GSOkmZHw5yBfrI9G9XYDJCaEIUOOQBWMQ85NIEG8nSdl_yWqtTZzYUvh6CLxjLkb0ZHuwrJMIU3XiL0kl6WXXYcjk/s1600/TempSensor.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihfmO8Mr4mFrKHqrbmTSVD5ecGMp9aw9DWYChCTQYOScKNXvWWx2GSOkmZHw5yBfrI9G9XYDJCaEIUOOQBWMQ85NIEG8nSdl_yWqtTZzYUvh6CLxjLkb0ZHuwrJMIU3XiL0kl6WXXYcjk/s320/TempSensor.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5554702285555118690&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/pre&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;El código del programa es el siguiente:&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;#include &lt;math.h&gt;&lt;/math.h&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;double Thermister(int RawADC) {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;double Temp;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Temp = log(((10240000/RawADC) - 10000));&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;/span&gt;Temp = Temp - 273.15;&lt;span style=&quot;&quot;&gt;            &lt;/span&gt;// Conversión de Kelvin a Celsius&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Conversión de Celsius a Fahrenheit&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;return Temp;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void setup() {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;pinMode(13, OUTPUT);&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Serial.begin(9600);&lt;span style=&quot;&quot;&gt;       &lt;/span&gt;// use the serial port&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;void loop() {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;int tempCelsius = int(Thermister(analogRead(0))-15);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;Serial.println(tempCelsius);&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;// display Celsius&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;if (tempCelsius &gt; 31) {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;digitalWrite(13, HIGH);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;tone(7, 150, 500);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;delay(1000);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;noTone(7); &lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;else {&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;digitalWrite(13, LOW);&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;&quot;&gt;  &lt;/span&gt;digitalWrite(7, HIGH);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt;   &lt;/span&gt;delay(1000);&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;&quot; lang=&quot;EN-GB&quot;&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;/span&gt;}&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;}&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Como se puede observar, la temperatura la mostramos en Celsius, aunque también se da la posibilidad (está comentada) de mostrarla en Fahrenheit.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Una explicación sobre la instrucción&lt;i&gt;: int tempCelsius = int(Thermister(analogRead(0))-15)&lt;/i&gt;. El –15 es una aproximación que hemos hecho “a mano”, ya que si no, no mostraba la temperatura real. Desconozco el motivo. Podéis jugar con ese número a vuestro gusto para adecuarlo a vuestro circuito.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Como última nota, decir que hemos puesto que la alarma salte cuando la temperatura es superior a 31 grados, para que saltase rápido y el vídeo, que viene a continuación con el resultado, no fuese demasiado largo. Hemos usado una lámpara para que la temperatura del termistor suba. También podéis probar con los dedos, ya que así se calienta rápido también. Para los más osados, siempre podéis poner la temperatura límite más alta, y pegarle fuego a vuestra casa... y veréis que funciona :P&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;He aquí el vídeo resultado:&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/RfasTeghP-Y?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/RfasTeghP-Y?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Eso es todo, espero que os haya gustado y os resulte útil.&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt; &lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;Un saludo :)&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/81119686712997143/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/sensor-de-temperatuar.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/81119686712997143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/81119686712997143'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/sensor-de-temperatuar.html' title='Sensor de temperatura'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihfmO8Mr4mFrKHqrbmTSVD5ecGMp9aw9DWYChCTQYOScKNXvWWx2GSOkmZHw5yBfrI9G9XYDJCaEIUOOQBWMQ85NIEG8nSdl_yWqtTZzYUvh6CLxjLkb0ZHuwrJMIU3XiL0kl6WXXYcjk/s72-c/TempSensor.JPG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-7080859906951816643</id><published>2010-12-25T03:22:00.001-08:00</published><updated>2010-12-25T06:34:13.062-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="iniciación"/><title type='text'>Para principiantes...</title><content type='html'>Hola a todos, éste es mi primer post en el blog, y estará dedicado a  hacer cuatro proyectos MUY sencillos (basados en los propios ejemplos de  la web oficial de Arduino) para principiantes en el mundo de Arduino  (entre los que me incluyo, con lo que correcciones y sugerencias serán  bienvenidas :)), ya que los posts que actualmente hay son un poco más  avanzados y no hay ninguno para newbies.&lt;br /&gt;&lt;br /&gt;Así que... allá vamos =)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;BLINK&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Éste es probablemente el proyecto más sencillo que se puede hacer con  Arduino, el de hacer parpadear un LED, encendiéndose y apagándose cada  segundo.&lt;br /&gt;&lt;br /&gt;Lo que haremos será conectar un LED al pin 13. Para ello, conectaremos  la &quot;patilla larga&quot; (la positiva, llamada ánodo) del LED al pin 13 de  nuestro Arduino. La otra patilla (la negativa, llamada cátodo) irá  conectada a tierra (GND).&lt;br /&gt;&lt;br /&gt;¿Por qué el pin 13? Pues bien, este pin lleva incorporada una pequeña  resistencia, suficiente para evitar daños en el LED, y así nos ahorramos  tener que hacer el proyecto en otro pin y ponerle nosotros la  resistencia.&lt;br /&gt;&lt;br /&gt;Bien, ahora simplemente tenemos que poner este código en nuestro IDE de Arduino:&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;Blink&lt;br /&gt;Turns on an LED on for one second, then off for one second, repeatedly.&lt;br /&gt;&lt;br /&gt;This example code is in the public domain.&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;void setup() {      &lt;br /&gt;// initialize the digital pin as an output.&lt;br /&gt;// Pin 13 has an LED connected on most Arduino boards:&lt;br /&gt;pinMode(13, OUTPUT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;digitalWrite(13, HIGH);   // set the LED on&lt;br /&gt;delay(1000);              // wait for a second&lt;br /&gt;digitalWrite(13, LOW);    // set the LED off&lt;br /&gt;delay(1000);              // wait for a second&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Este código lo podéis cargar directamente los ejemplos que vienen ya en el IDE: File-&gt;Examples-&gt;1.Basics-&gt;Blink.&lt;br /&gt;&lt;br /&gt;Ahora simplemente, le damos a&lt;span style=&quot;font-style: italic;&quot;&gt; Upload&lt;/span&gt; para pasar el programa a la placa, y observar el resultado.&lt;br /&gt;&lt;br /&gt;Se puede observar lo anterior en el siguiente vídeo:&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/zBTEScJWM_A?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/zBTEScJWM_A?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Como véis, ha sido muy sencillo&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;FADE2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Ésta es una ligera modificación del programa de ejemplo &lt;span style=&quot;font-style: italic;&quot;&gt;Fade&lt;/span&gt; (File-&gt;Examples-&gt;1.Basics-&gt;Fade), en el que se hace parpadear gradualmente un LED, conectándolo al pin 9. En el sencillo proyecto que nosotros haremos, conectaremos tres LEDs en paralelo, y usaremos una protoboard. El circuito queda de la siguiente forma:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTGTtzM2hD0sgH56k9Dp9IfnxmuVRkVJ8nyFxFHZo1lGWN-5GQ7znjlIPdTIcdn2GnllEBgbsH03pvDmqvcUCbAtlWD1Yjfty_sgY2WWiTqNAMqUMUckUXJe2ZS48BtuXlgMEymk7eq-Q/s1600/Fade2.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTGTtzM2hD0sgH56k9Dp9IfnxmuVRkVJ8nyFxFHZo1lGWN-5GQ7znjlIPdTIcdn2GnllEBgbsH03pvDmqvcUCbAtlWD1Yjfty_sgY2WWiTqNAMqUMUckUXJe2ZS48BtuXlgMEymk7eq-Q/s320/Fade2.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5554585749714102530&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Como se puede ver hemos usado una resistencia (de 220 Ohms), y hemos colocado los tres LEDs en paralelo, de forma que si uno de ellos se quita de la placa de prototipado, los demás seguirán funcionando. Se puede apreciar cómo hemos puesto dos jumpers para unir dos secciones de la protoboard, ya que, pese a que los puntos de la protoboard sólo están conectados verticalmente, las secciones no están conectadas entre sí.&lt;br /&gt;&lt;br /&gt;Hemos conectado al pin 9 y a tierra (negativo con tierra).&lt;br /&gt;&lt;br /&gt;El código usado es el siguiente:&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;Fade&lt;br /&gt;&lt;br /&gt;This example shows how to fade an LED on pin 9&lt;br /&gt;using the analogWrite() function.&lt;br /&gt;&lt;br /&gt;This example code is in the public domain.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;int brightness = 0;    // how bright the LED is&lt;br /&gt;int fadeAmount = 5;    // how many points to fade the LED by&lt;br /&gt;&lt;br /&gt;void setup()  {&lt;br /&gt;// declare pin 9 to be an output:&lt;br /&gt;pinMode(9, OUTPUT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop()  {&lt;br /&gt;// set the brightness of pin 9:&lt;br /&gt;analogWrite(9, brightness);&lt;br /&gt;&lt;br /&gt;// change the brightness for next time through the loop:&lt;br /&gt;brightness = brightness + fadeAmount;&lt;br /&gt;&lt;br /&gt;// reverse the direction of the fading at the ends of the fade:&lt;br /&gt;if (brightness == 0 || brightness == 255) {&lt;br /&gt;fadeAmount = -fadeAmount ;&lt;br /&gt;}&lt;br /&gt;// wait for 20 milliseconds to see the dimming effect&lt;br /&gt;delay(20);                   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;(Podemos jugar con el fadeAmount y el delay, para que haga fade a otro ritmo).&lt;br /&gt;&lt;br /&gt;El resultado, después de subir el programa a Arduino es el siguiente:&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/P7BmvzRL4cA?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/P7BmvzRL4cA?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;toneMelody_StarWars&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;En éste proyecto, haremos uso del código que puede verse en el ejemplo &lt;span style=&quot;font-style: italic;&quot;&gt;toneMelody&lt;/span&gt; (File-&gt;Examples-&gt;1.Digital-&gt;toneMelody). Lo que haremos será usar un zumbador piezo (piezo buzzer) y una resistencia (yo uso una de 220 Ohmios, pero si tenéis una de 100 usadla), para sacar el sonido o melodía que nosotros queramos, en este caso una muy breve melodía de Star Wars, usando el pin digital 8. Haremos uso del fichero p&lt;span style=&quot;font-style: italic;&quot;&gt;itches.h&lt;/span&gt; (viene con el programa toneMelody), que define cada nota con el pitch de dicha nota... traduciendo: define cómo debe sonar cáda nota que pongamos. Como nota aclaratoria, decir que las notas vienen en el sistema de notación musical inglés:&lt;br /&gt;&lt;br /&gt;C-&gt;Do&lt;br /&gt;D-&gt;Re&lt;br /&gt;E-&gt;Mi&lt;br /&gt;F-&gt;Fa&lt;br /&gt;G-&gt;Sol&lt;br /&gt;A-&gt;La&lt;br /&gt;B-&gt;Si&lt;br /&gt;&lt;br /&gt;El número que llevan al lado es la &quot;altura&quot; a la que está dicha nota, para variar entre escalas.&lt;br /&gt;&lt;br /&gt;El circuito, una vez montado queda así:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg18fR5WNHWROHv56fVgYlJ2X-Fig4afONYHnlp24IQAMswnIv6oQbz0_mKKxGSAaUDyJeiDluY27ZxC_86Huxkp5XX_exO4AtjLGwkNL0PpD4LLeQZHuo5-Ee_odPTeFaoJqpKBoQbMxk/s1600/toneMelody_StarWars.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg18fR5WNHWROHv56fVgYlJ2X-Fig4afONYHnlp24IQAMswnIv6oQbz0_mKKxGSAaUDyJeiDluY27ZxC_86Huxkp5XX_exO4AtjLGwkNL0PpD4LLeQZHuo5-Ee_odPTeFaoJqpKBoQbMxk/s320/toneMelody_StarWars.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5554593332526291314&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Como se puede ver, es muy simple.&lt;br /&gt;&lt;br /&gt;El código de nuestro programa es el siguiente:&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;Melody&lt;br /&gt;&lt;br /&gt;Plays a melody&lt;br /&gt;&lt;br /&gt;circuit:&lt;br /&gt;* 8-ohm speaker on digital pin 8&lt;br /&gt;&lt;br /&gt;created 21 Jan 2010&lt;br /&gt;by Tom Igoe&lt;br /&gt;&lt;br /&gt;This example code is in the public domain.&lt;br /&gt;&lt;br /&gt;http://arduino.cc/en/Tutorial/Tone&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;#include &quot;pitches.h&quot;&lt;br /&gt;&lt;br /&gt;// notes in the melody:&lt;br /&gt;int melody[] = {&lt;br /&gt;NOTE_C3,NOTE_C3, NOTE_C3, NOTE_GS2, NOTE_DS3, NOTE_C3, NOTE_GS2, NOTE_DS3, NOTE_C3, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_GS4, NOTE_DS4, NOTE_C4, NOTE_GS2, NOTE_DS3, NOTE_C3 };&lt;br /&gt;// note durations: 4 = quarter note, 8 = eighth note, etc.:&lt;br /&gt;int noteDurations[] = {&lt;br /&gt;4,4,4,4,8,4,4,8,4, 4,4,4,4,8,4,4,8,4};&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;// iterate over the notes of the melody:&lt;br /&gt;for (int thisNote = 0; thisNote &lt; note =&quot; 1000&quot; note =&quot; 1000/8,&quot; noteduration =&quot; 1000/noteDurations[thisNote];&quot; pausebetweennotes =&quot; noteDuration&quot; style=&quot;font-style: italic;&quot;&gt;melody, y en el array &lt;span style=&quot;font-style: italic;&quot;&gt;noteDurations&lt;/span&gt; ponemos si quieremos que sea una negra, corchea...&lt;br /&gt;&lt;br /&gt;Podéis jugar con las notas y duraciones, y hacer cualquier melodía. La mía, de prueba, como dije arriba, es una parte corta de un theme de Star Wars. He aquí el resultado despues de subirlo a Arduino:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/LHnxpPGd3Os?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/LHnxpPGd3Os?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;KNOCK2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;En este último proyecto, usaremos un piezo para detectar vibración (podéis encontrar el ejemplo en File-&gt;Examples-&gt;6.Sensors-&gt;Knock); para ello usaremos el piezo buzzer que usamos anteriormente (no es demasiado bueno), y una resistencia de 1MegaOhm. Entre que mi piezo es malillo, y que no tengo una resistencia de 1MegaOhm, he tenido que hacer ciertos ajustes, pero aún así no capta ruidos desde lejos, y como mejor reacciona es dándole un golpe seco al piezo, para que vibre con fuerza.&lt;br /&gt;&lt;br /&gt;Cada vez que detecte vibración, nos lo hará saber mediante un LED que colocaremos en el pin 13 (cambiará su estado cuando esto ocurra), y mediante el Serial Monitor (Tools-&gt;Serial Monitor), en el cual escribirá &quot;Knock!&quot;.&lt;br /&gt;&lt;br /&gt;Veamos cómo hemos montado el circuito:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRiF6HfwCUL5ki6B8C7iQ0U4DyFExaDMPKqdp36Qobc_9CDjtIAAUtayz-zVMoR1NLLp9PkktC2by40kSGE-fePqddUzKXRz6w85x9v4pSboEc4PYscoMc2HWZtTPBWlPF0fWO5P_5EP0/s1600/Knock2.JPG&quot;&gt;&lt;img style=&quot;float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRiF6HfwCUL5ki6B8C7iQ0U4DyFExaDMPKqdp36Qobc_9CDjtIAAUtayz-zVMoR1NLLp9PkktC2by40kSGE-fePqddUzKXRz6w85x9v4pSboEc4PYscoMc2HWZtTPBWlPF0fWO5P_5EP0/s320/Knock2.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5554600366857407426&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;display: block; font-weight: bold;&quot; id=&quot;formatbar_Buttons&quot;&gt;&lt;span class=&quot;down&quot; style=&quot;display: block;&quot; id=&quot;formatbar_Bold&quot; title=&quot;Negrita&quot;&gt;&lt;img src=&quot;http://www.blogger.com/img/blank.gif&quot; alt=&quot;Negrita&quot; class=&quot;gl_bold&quot; border=&quot;0&quot; /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lo ideal habría sido conectarle una resistencia de 1MegaOhm en paralelo al piezo, pero como no tengo, he tenido que ponerle, como se ve en la imagen, tres resistencias de 330k puestas en serie entre ellas. De nuevo he puesto jumpers para conectar ambas partes de la protoboard. Como vemos, conectamos a tierra y a la entrada analógica A0, ya que por ahí se enviará el resultado a nuestro Arduino.&lt;br /&gt;&lt;br /&gt;Por otro lado, vemos como hemos conectado un LED en el pin 13, como ya hicimos en el primer proyecto.&lt;br /&gt;&lt;br /&gt;He aquí el código del programa:&lt;br /&gt;&lt;br /&gt;/* Knock Sensor&lt;br /&gt;&lt;br /&gt;This sketch reads a piezo element to detect a knocking sound.&lt;br /&gt;It reads an analog pin and compares the result to a set threshold.&lt;br /&gt;If the result is greater than the threshold, it writes&lt;br /&gt;&quot;knock&quot; to the serial port, and toggles the LED on pin 13.&lt;br /&gt;&lt;br /&gt;The circuit:&lt;br /&gt;* + connection of the piezo attached to analog in 0&lt;br /&gt;* - connection of the piezo attached to ground&lt;br /&gt;* 1-megohm resistor attached from analog in 0 to ground&lt;br /&gt;&lt;br /&gt;http://www.arduino.cc/en/Tutorial/Knock&lt;br /&gt;&lt;br /&gt;created 25 Mar 2007&lt;br /&gt;by David Cuartielles &lt;http: org=&quot;&quot;&gt;&lt;br /&gt;modified 4 Sep 2010&lt;br /&gt;by Tom Igoe&lt;br /&gt;&lt;br /&gt;This example code is in the public domain.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// these constants won&#39;t change:&lt;br /&gt;const int ledPin = 13;      // led connected to digital pin 13&lt;br /&gt;const int knockSensor = A0; // the piezo is connected to analog pin 0&lt;br /&gt;const int threshold = 1;  // threshold value to decide when the detected sound is a knock or not&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// these variables will change:&lt;br /&gt;int sensorReading = 0;      // variable to store the value read from the sensor pin&lt;br /&gt;int ledState = LOW;         // variable used to store the last LED status, to toggle the light&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT&lt;br /&gt;Serial.begin(9600);       // use the serial port&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;// read the sensor and store it in the variable sensorReading:&lt;br /&gt;sensorReading = analogRead(knockSensor);&lt;br /&gt;&lt;br /&gt;// if the sensor reading is greater than the threshold:&lt;br /&gt;if (sensorReading &gt;= threshold) {&lt;br /&gt;// toggle the status of the ledPin:&lt;br /&gt;ledState = !ledState;&lt;br /&gt;// update the LED pin itself:&lt;br /&gt;digitalWrite(ledPin, ledState);&lt;br /&gt;// send the string &quot;Knock!&quot; back to the computer, followed by newline&lt;br /&gt;Serial.println(&quot;Knock!&quot;);&lt;br /&gt;}&lt;br /&gt;delay(100);  // delay to avoid overloading the serial port buffer&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Como vemos, hemos puesto &lt;span style=&quot;font-style: italic;&quot;&gt;const int threshold = 1&lt;/span&gt;. ¿Qué es el threshold? Es el umbral que queremos poner como sensibilidad de detección del ruido necesario para activar el LED e imprimir por pantalla. Yo he puesto 1, porque como dije antes, no cuento con material de primera. Sin embargo, en el programa venía por defecto 300... es decir, que juguéis con el umbral a vuestro gusto y como mejor véais que funciona.&lt;br /&gt;&lt;br /&gt;El resultado, después de subirlo al Arduino, puede verse aquí:&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/d3Fh7LNUUpw?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/d3Fh7LNUUpw?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pues bien, esto es todo por hoy. Como digo son proyectos muy sencillos para gente que está empezando. Cualquier sugerencia, correción o similares, será de gran ayuda.&lt;br /&gt;&lt;br /&gt;Un saludo.&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/http:&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/7080859906951816643/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/para-principiantes.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7080859906951816643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7080859906951816643'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/12/para-principiantes.html' title='Para principiantes...'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTGTtzM2hD0sgH56k9Dp9IfnxmuVRkVJ8nyFxFHZo1lGWN-5GQ7znjlIPdTIcdn2GnllEBgbsH03pvDmqvcUCbAtlWD1Yjfty_sgY2WWiTqNAMqUMUckUXJe2ZS48BtuXlgMEymk7eq-Q/s72-c/Fade2.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-7341587506196715186</id><published>2010-11-08T13:51:00.000-08:00</published><updated>2010-11-08T15:13:30.853-08:00</updated><title type='text'>Radio control Memo car</title><content type='html'>&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;XD antes que nada, tremendo el título del artículo. Este proyecto trata de manejar nuestro coche radio control, mediante un PC. con las teclas AWSD por ejemplo y poder memorizar el camino que hemos hecho.&lt;br /&gt;&lt;br /&gt;Lo primero es el material del que disponemos. Utilizaremos un coche de juguete tyco, aunque cualquiera nos vale ya que no vamos a tocar el coche para nada, simplemente puentearemos el mando para poder manejarlo con arduino.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimVOd9SzXzK3Xxw5MqGG7PMZYfd58Qhhcpz5E7o6LbssHWsFkXQxkHxRZdCChfUFQP39_bVGWSQ8CaWNNsni8nCrYCVAmQMAmhAMQC2ZSS2z_w7lBP_OXdQdBc7B0TAKPCf8B-ggJqnZg/s1600/IMG_0851.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimVOd9SzXzK3Xxw5MqGG7PMZYfd58Qhhcpz5E7o6LbssHWsFkXQxkHxRZdCChfUFQP39_bVGWSQ8CaWNNsni8nCrYCVAmQMAmhAMQC2ZSS2z_w7lBP_OXdQdBc7B0TAKPCf8B-ggJqnZg/s320/IMG_0851.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537301444457656978&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijpcisV6mZC5sFU0uVpFy2KRRLK4bPPdbiq5X1vj7_JqWhtiQGv-ST2kT3S4K-ccxNYJbKwHHCADuUJjX3YzyPX5DQfdgAcOXRr3XRnEE7oG_TcorlZNk-tJtjRQIR3FxN0hoa-jiYWuw/s1600/IMG_0865.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijpcisV6mZC5sFU0uVpFy2KRRLK4bPPdbiq5X1vj7_JqWhtiQGv-ST2kT3S4K-ccxNYJbKwHHCADuUJjX3YzyPX5DQfdgAcOXRr3XRnEE7oG_TcorlZNk-tJtjRQIR3FxN0hoa-jiYWuw/s320/IMG_0865.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537301137776733602&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;El coche va sin su carcasa, no es que esté roto... , y el mando ya en su acabado final con sus cables de conexión a la placa de control.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;La placa de control:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Para poder comunicar el arduino con el mando he construido un pekeño shield que ahora explicaré su funcionamiento.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyyYd5SVLJaqMDMGcshoZN7p6709WvH47fb1_5K4ki5xVrxrMT0BhQd4jx5g_vh7A-TEJtCwM4hhPAszXoj01JXdzrH2Xcm7GS7NFwQASKg45SIateg9RdN2lTW-3aJ-4PBNoWtBNIox0/s1600/IMG_0853.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyyYd5SVLJaqMDMGcshoZN7p6709WvH47fb1_5K4ki5xVrxrMT0BhQd4jx5g_vh7A-TEJtCwM4hhPAszXoj01JXdzrH2Xcm7GS7NFwQASKg45SIateg9RdN2lTW-3aJ-4PBNoWtBNIox0/s320/IMG_0853.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537302333453138226&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0Dyd7nfXx6luAeNY0YNfgAUjeBjho-Y86qQ865HDFyaYnYidh__v3IIOFWSAnrcOQzwMCa6VRoQUoMrSREKv_ov8mtY2HYOvKuIWNkgUzDb7xIyKoquhyphenhyphenK-KdQd9Pbu04QXARzvQQJ8/s1600/IMG_0854.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0Dyd7nfXx6luAeNY0YNfgAUjeBjho-Y86qQ865HDFyaYnYidh__v3IIOFWSAnrcOQzwMCa6VRoQUoMrSREKv_ov8mtY2HYOvKuIWNkgUzDb7xIyKoquhyphenhyphenK-KdQd9Pbu04QXARzvQQJ8/s320/IMG_0854.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537302642987656466&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;El circuito es bastante simple, se compone de 4 transistores BC337 con los cuales conmuto el circuito entre la tierra y las conexiones del mando. Con 4 pines de arduino controlaré digitalmente si acciono cada uno de los interruptores del mando.&lt;br /&gt;Cabe destacar que este coche es digital, no tiene aceleración gradual ni giro gradual, todas sus acciones son binarias.&lt;br /&gt;&lt;br /&gt;PD: &lt;span style=&quot;font-style: italic;&quot;&gt;yo no sabía como funcionaba un transistor como este  pero es bastante fácil, tienen 3 patas, las de los lados las conectas al circuito y la del medio al arduino, y si el arduino mete voltaje por ahi, el circuito se abre. Es como un interruptor pero en lugar de botón para encender o apagar, se le manda una señal por la pata del medio&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY0iLEwS-K7Sa_g-Sp29Yz9CK8G1FVWf5-M8ltrULaJG9AiO0Idy6HnbVwOCsePmMTT5EPTUIAZQSf1Z7Bd5Cn4BBRW9uiqX3GQqXvyDAOwRhFB-59q71rSd8dw5Fs4iT__bsNcZx_2rM/s1600/IMG_0850.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY0iLEwS-K7Sa_g-Sp29Yz9CK8G1FVWf5-M8ltrULaJG9AiO0Idy6HnbVwOCsePmMTT5EPTUIAZQSf1Z7Bd5Cn4BBRW9uiqX3GQqXvyDAOwRhFB-59q71rSd8dw5Fs4iT__bsNcZx_2rM/s320/IMG_0850.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537302827870064242&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghz3BXQbXbFUpIGgKg7xlNxCZ5sNwCtP7HpMJpfgRZfCKiewcbfgaHi5vtklGx5O51C0TU22meIe8Mi-gLwNhvs_ZvWAAqkfAtQ3Rr52Wa0SpBVwDaEc_J1qvROSkEQXImvO0HiCVMZcQ/s1600/IMG_0864.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghz3BXQbXbFUpIGgKg7xlNxCZ5sNwCtP7HpMJpfgRZfCKiewcbfgaHi5vtklGx5O51C0TU22meIe8Mi-gLwNhvs_ZvWAAqkfAtQ3Rr52Wa0SpBVwDaEc_J1qvROSkEQXImvO0HiCVMZcQ/s320/IMG_0864.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537302981322602226&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;El montaje del sistema es facil y rápido.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;El mando y sus conexiones:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Llevó su tiempo buscar los puntos donde le hacía cosquillas al mando pero al final gracias a Isra en gran parte encontramos el funcionamiento básico del mando y como puentearlo:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieiWQHx-U5I0cNk4X4O06ucH-Z0Cwes0MhrVz8iw8Khqwq77giesR2wNvN2pKtk-rwjDK0KTmkZqERMG7MOTPwYNSPClhhwcxcxBHDRZF03W1wWTpKchr-yeOMuZa9gAB0Hj3nSEHbD58/s1600/IMG_0861.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieiWQHx-U5I0cNk4X4O06ucH-Z0Cwes0MhrVz8iw8Khqwq77giesR2wNvN2pKtk-rwjDK0KTmkZqERMG7MOTPwYNSPClhhwcxcxBHDRZF03W1wWTpKchr-yeOMuZa9gAB0Hj3nSEHbD58/s320/IMG_0861.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537305219841260130&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiZ1iZCJ7Lnr_KI3NwLlQV_-2Wu4x0OJOC_qEaQf7HgsMyzb6_H-FRQ05QkwruadGiS1iPOREP4qRCEw2GepZpjK2W7XcSr5urFYkHFSpBdaMb6M7ELcUmmmcY4i6FqdmeeYsBOCaJoP0/s1600/IMG_0862.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiZ1iZCJ7Lnr_KI3NwLlQV_-2Wu4x0OJOC_qEaQf7HgsMyzb6_H-FRQ05QkwruadGiS1iPOREP4qRCEw2GepZpjK2W7XcSr5urFYkHFSpBdaMb6M7ELcUmmmcY4i6FqdmeeYsBOCaJoP0/s320/IMG_0862.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5537305400696527698&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Como vemos en las imágenes, hemos tenido que abrir el mando y acceder por la parte posterior a las soldaduras. En la foto de la derecha, los cables rojo y negro de arriba izquierda, son los conectores para girar el coche, los de arriba derecha es el acelerador y la marcha atrás. Y abajo donde coincide con el cable azul, es la tierra, que es &lt;span style=&quot;font-style: italic;&quot;&gt;muy importante que la tierra del mando esté conectada a la tierra de arduino&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;La programación de Arduino:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;En arduino simplemente tendremos un programa que dado un numero que nos viene por serie, hace una acción u otra por los pines de control.&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;div&gt;const int ledPin = 9;      // the pin that the LED is attached to&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void setup()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  // initialize the serial communication:&lt;/div&gt;&lt;div&gt;  Serial.begin(9600);&lt;/div&gt;&lt;div&gt;  // initialize the ledPin as an output:&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;   pinMode(2, OUTPUT); //up&lt;/div&gt;&lt;div&gt;   pinMode(3, OUTPUT); //down&lt;/div&gt;&lt;div&gt;   pinMode(4, OUTPUT); //right&lt;/div&gt;&lt;div&gt;   pinMode(5, OUTPUT); //left&lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;   digitalWrite(2, B0);&lt;/div&gt;&lt;div&gt;   digitalWrite(3, B0);&lt;/div&gt;&lt;div&gt;   digitalWrite(4, B0);&lt;/div&gt;&lt;div&gt;   digitalWrite(5, B0);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void loop() {&lt;/div&gt;&lt;div&gt;  byte val;&lt;/div&gt;&lt;div&gt;  int WEST = 8;&lt;/div&gt;&lt;div&gt;  int SOUTH = 4;&lt;/div&gt;&lt;div&gt;  int EAST = 2;&lt;/div&gt;&lt;div&gt;  int NORTH = 1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (Serial.available()) {&lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;    val = Serial.read();&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    (val &amp;amp; NORTH)?digitalWrite(2, B1):digitalWrite(2, B0);&lt;/div&gt;&lt;div&gt;    (val &amp;amp; EAST)?digitalWrite(3, B1):digitalWrite(3, B0);&lt;/div&gt;&lt;div&gt;    (val &amp;amp; SOUTH)?digitalWrite(4, B1):digitalWrite(4, B0);&lt;/div&gt;&lt;div&gt;    (val &amp;amp; WEST)?digitalWrite(5, B1):digitalWrite(5, B0);   &lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;La programación de Processing:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Processing es el que tiene la miga, este se encarga de enviarle a arduino las teclas que estámos pulsando, para que arduino mueva el coche. Pero además llevará un sistema de log de teclas que irá guardando en un fichero para poder reproducir la secuencia programada.&lt;br /&gt;&lt;br /&gt;Teclas:&lt;br /&gt;ASDW : teclas de dirección&lt;br /&gt;R: Empezar a grabar camino&lt;br /&gt;P: Reproducir secuencia grabada (la secuencia se reproducirá en bucle infinito)&lt;br /&gt;U: Stop, tanto para grabar como para reproducir&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;final static int NORTH = 2;&lt;/div&gt;&lt;div&gt;final static int EAST = 4;&lt;/div&gt;&lt;div&gt;final static int SOUTH = 1;&lt;/div&gt;&lt;div&gt;final static int WEST = 8;&lt;/div&gt;&lt;div&gt;final static int TURBO = 16;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;boolean record = false;&lt;/div&gt;&lt;div&gt;boolean play = false;&lt;/div&gt;&lt;div&gt;int result;&lt;/div&gt;&lt;div&gt;import processing.serial.*;&lt;/div&gt;&lt;div&gt;Serial port;&lt;/div&gt;&lt;div&gt;PrintWriter output;&lt;/div&gt;&lt;div&gt;String[] lines;&lt;/div&gt;&lt;div&gt;int index = 0;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void all(int colori){&lt;/div&gt;&lt;div&gt;  izq(colori);&lt;/div&gt;&lt;div&gt;  der(colori);&lt;/div&gt;&lt;div&gt;  arr(colori);&lt;/div&gt;&lt;div&gt;  aba(colori);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void izq(int colori){&lt;/div&gt;&lt;div&gt;  fill(colori);&lt;/div&gt;&lt;div&gt;  rect(10,50,30,40);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;void der(int colori){&lt;/div&gt;&lt;div&gt;  fill(colori);&lt;/div&gt;&lt;div&gt;  rect(80,50,30,40);&lt;/div&gt;&lt;div&gt;} &lt;/div&gt;&lt;div&gt;void arr(int colori){&lt;/div&gt;&lt;div&gt;  fill(colori);&lt;/div&gt;&lt;div&gt;  rect(40,10,40,40);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;void aba(int colori){&lt;/div&gt;&lt;div&gt;  fill(colori);&lt;/div&gt;&lt;div&gt;  rect(40,90,40,40);&lt;/div&gt;&lt;div&gt;} &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void setup() {&lt;/div&gt;&lt;div&gt;  size(400,200);&lt;/div&gt;&lt;div&gt;  frameRate(30);  &lt;/div&gt;&lt;div&gt;  result = 0;&lt;/div&gt;&lt;div&gt;  port = new Serial(this, Serial.list()[0], 9600); &lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;  background(0);&lt;/div&gt;&lt;div&gt;  all(33);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void draw() {&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;  if (record) {&lt;/div&gt;&lt;div&gt;    output.println(result);&lt;/div&gt;&lt;div&gt;    output.flush();&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  if (play) {&lt;/div&gt;&lt;div&gt;     if (index &lt;&gt;&lt;div&gt;     result = int(lines[index]);  &lt;/div&gt;&lt;div&gt;     index = index + 1;&lt;/div&gt;&lt;div&gt;     } else index = 0;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  switch(result) {&lt;/div&gt;&lt;div&gt;    case NORTH: &lt;/div&gt;&lt;div&gt;      port.write(NORTH);&lt;/div&gt;&lt;div&gt;      arr(255);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    case TURBO|NORTH:&lt;/div&gt;&lt;div&gt;      port.write(SOUTH|NORTH);&lt;/div&gt;&lt;div&gt;      arr(150);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    case TURBO|NORTH|WEST:&lt;/div&gt;&lt;div&gt;      port.write(SOUTH|NORTH|WEST);&lt;/div&gt;&lt;div&gt;      arr(150);&lt;/div&gt;&lt;div&gt;      der(33);&lt;/div&gt;&lt;div&gt;      izq(150);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    case TURBO|NORTH|EAST:&lt;/div&gt;&lt;div&gt;      port.write(SOUTH|NORTH|EAST);&lt;/div&gt;&lt;div&gt;      arr(150);&lt;/div&gt;&lt;div&gt;      der(150);&lt;/div&gt;&lt;div&gt;      izq(33);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    case EAST: &lt;/div&gt;&lt;div&gt;      port.write(EAST);&lt;/div&gt;&lt;div&gt;      der(255);&lt;/div&gt;&lt;div&gt;      izq(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    case SOUTH: &lt;/div&gt;&lt;div&gt;       port.write(SOUTH);&lt;/div&gt;&lt;div&gt;       aba(255);&lt;/div&gt;&lt;div&gt;       arr(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;    case WEST: &lt;/div&gt;&lt;div&gt;      port.write(WEST);&lt;/div&gt;&lt;div&gt;      izq(255);&lt;/div&gt;&lt;div&gt;      der(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;    case NORTH|EAST: &lt;/div&gt;&lt;div&gt;      port.write(NORTH|EAST); &lt;/div&gt;&lt;div&gt;      arr(255);&lt;/div&gt;&lt;div&gt;      der(255);&lt;/div&gt;&lt;div&gt;      izq(33);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;   &lt;/div&gt;&lt;div&gt;    case NORTH|WEST: &lt;/div&gt;&lt;div&gt;      arr(255);&lt;/div&gt;&lt;div&gt;      der(33);&lt;/div&gt;&lt;div&gt;      izq(255);&lt;/div&gt;&lt;div&gt;      aba(33);&lt;/div&gt;&lt;div&gt;      port.write(NORTH|WEST); &lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;    case SOUTH|EAST: &lt;/div&gt;&lt;div&gt;      arr(33);&lt;/div&gt;&lt;div&gt;      der(255);&lt;/div&gt;&lt;div&gt;      izq(33);&lt;/div&gt;&lt;div&gt;      aba(255);&lt;/div&gt;&lt;div&gt;      port.write(SOUTH|EAST); &lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;    case SOUTH|WEST: &lt;/div&gt;&lt;div&gt;      arr(33);&lt;/div&gt;&lt;div&gt;      der(33);&lt;/div&gt;&lt;div&gt;      izq(255);&lt;/div&gt;&lt;div&gt;      aba(255);&lt;/div&gt;&lt;div&gt;      port.write(SOUTH|WEST); &lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div&gt;    default:&lt;/div&gt;&lt;div&gt;      port.write(0);&lt;/div&gt;&lt;div&gt;      all(33);&lt;/div&gt;&lt;div&gt;    break;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void keyPressed(){&lt;/div&gt;&lt;div&gt;  switch(key) {&lt;/div&gt;&lt;div&gt;    case(&#39;w&#39;):case(&#39;W&#39;):result |=NORTH;break;&lt;/div&gt;&lt;div&gt;    case(&#39;d&#39;):case(&#39;D&#39;):result |=EAST;break;&lt;/div&gt;&lt;div&gt;    case(&#39;s&#39;):case(&#39;S&#39;):result |=SOUTH;break;&lt;/div&gt;&lt;div&gt;    case(&#39;a&#39;):case(&#39;A&#39;):result |=WEST;break;&lt;/div&gt;&lt;div&gt;    case(&#39;t&#39;):case(&#39;T&#39;):result |=TURBO;break;&lt;/div&gt;&lt;div&gt;    case(&#39;r&#39;):case(&#39;R&#39;):&lt;/div&gt;&lt;div&gt;          output = createWriter(&quot;save.txt&quot;);&lt;/div&gt;&lt;div&gt;          record = true; &lt;/div&gt;&lt;div&gt;          play = false;&lt;/div&gt;&lt;div&gt;          break;&lt;/div&gt;&lt;div&gt;    case(&#39;u&#39;):case(&#39;U&#39;):record = false; play = false;break;&lt;/div&gt;&lt;div&gt;    case(&#39;p&#39;):case(&#39;P&#39;):&lt;/div&gt;&lt;div&gt;          play = true; &lt;/div&gt;&lt;div&gt;          record = false;&lt;/div&gt;&lt;div&gt;          output.flush();&lt;/div&gt;&lt;div&gt;          output.close(); &lt;/div&gt;&lt;div&gt;          lines = loadStrings(&quot;save.txt&quot;);&lt;/div&gt;&lt;div&gt;          index = 0;&lt;/div&gt;&lt;div&gt;          break;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;void keyReleased(){  &lt;/div&gt;&lt;div&gt;  switch(key) {&lt;/div&gt;&lt;div&gt;    case(&#39;w&#39;):case(&#39;W&#39;):result ^=NORTH;break;&lt;/div&gt;&lt;div&gt;    case(&#39;d&#39;):case(&#39;D&#39;):result ^=EAST;break;&lt;/div&gt;&lt;div&gt;    case(&#39;s&#39;):case(&#39;S&#39;):result ^=SOUTH;break;&lt;/div&gt;&lt;div&gt;    case(&#39;a&#39;):case(&#39;A&#39;):result ^=WEST;break;&lt;/div&gt;&lt;div&gt;    case(&#39;t&#39;):case(&#39;T&#39;):result ^=TURBO;break;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;Video:&lt;br /&gt;&lt;br /&gt;&lt;object width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/BfC8ongsWPg?fs=1&amp;amp;hl=es_ES&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/BfC8ongsWPg?fs=1&amp;amp;hl=es_ES&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;480&quot; height=&quot;385&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/7341587506196715186/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/11/radio-control-memo-car.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7341587506196715186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7341587506196715186'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/11/radio-control-memo-car.html' title='Radio control Memo car'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimVOd9SzXzK3Xxw5MqGG7PMZYfd58Qhhcpz5E7o6LbssHWsFkXQxkHxRZdCChfUFQP39_bVGWSQ8CaWNNsni8nCrYCVAmQMAmhAMQC2ZSS2z_w7lBP_OXdQdBc7B0TAKPCf8B-ggJqnZg/s72-c/IMG_0851.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-1969797199119852359</id><published>2010-07-07T06:47:00.000-07:00</published><updated>2010-07-08T13:39:58.666-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino stepper solar"/><title type='text'>Sun tracking mini edition</title><content type='html'>Oh hi!, ayer miré al &quot;motor paso a paso&quot;, el me miró a mi y coincidiendo que yo llevaba un panel solar en mis manos, se me ocurrió una idea absurda con la que unir ambas cosas. Nada más y nada menos que un super inutil buscador del sol, como los lindos girasoles que hay en los campos.&lt;br /&gt;&lt;br /&gt;Lo que más me costó fué ingeniarmelas para poner el panel en el motor, pero al final di con la solución gracias a la parte de goma que tienen los bolis estos caros. he aki una foto de lo bien que encaja.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXhuHIfMEYh7yJMRZsRU-A1DPsXYHeqTz4e74X6jKZtz6Q6ZNAHcNmqav44aodlF-okmGC1OiNODubmCwWR35azqMvuz-wQhyphenhyphenUtlCkQYf8NEt9GR1OuBPw8tsQrRI0oIjYNMcXps1ND5I/s1600/IMG_0684.jpg&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXhuHIfMEYh7yJMRZsRU-A1DPsXYHeqTz4e74X6jKZtz6Q6ZNAHcNmqav44aodlF-okmGC1OiNODubmCwWR35azqMvuz-wQhyphenhyphenUtlCkQYf8NEt9GR1OuBPw8tsQrRI0oIjYNMcXps1ND5I/s320/IMG_0684.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5491167189702192258&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVxH6bidfYmjB6IdZqtfmUSgIvtT_9AG_gvma4i6kF8KsnU-hZ0xkVrJozm-94MHrgUVH8fAaC6TMidJFgM46aJoLwhTrnYtG6e6jsb9kkFsrIyvABz5D6T5J9Vj2YTcrX_67FGgHmtRE/s1600/IMG_0678.jpg&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVxH6bidfYmjB6IdZqtfmUSgIvtT_9AG_gvma4i6kF8KsnU-hZ0xkVrJozm-94MHrgUVH8fAaC6TMidJFgM46aJoLwhTrnYtG6e6jsb9kkFsrIyvABz5D6T5J9Vj2YTcrX_67FGgHmtRE/s320/IMG_0678.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5491167374879727986&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;El motor y las demás piezas las he encajado en un carton para que no se muevan, que sinó, vaya fiesta.&lt;br /&gt;&lt;br /&gt;En cuanto al control del motor, he seguido el mismo esquema que en el &lt;a href=&quot;http://arduinotesting.blogspot.com/2010/07/motor-paso-paso-con-arduino.html&quot;&gt;post anterior&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWJoEOK9lA3G2Rwv7_TGKj3sUwf9TqTAoYRyQ_wOKWZofkrM1y57i9T78jltSo654U2n-g4mK6Ww8upDtPO3pVqVv1s5FnX_AP42Pe5ktJY9Um5AXhxoD0BF9DNe1hJjFkUbKWuRLdYgI/s1600/IMG_0681.jpg&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWJoEOK9lA3G2Rwv7_TGKj3sUwf9TqTAoYRyQ_wOKWZofkrM1y57i9T78jltSo654U2n-g4mK6Ww8upDtPO3pVqVv1s5FnX_AP42Pe5ktJY9Um5AXhxoD0BF9DNe1hJjFkUbKWuRLdYgI/s320/IMG_0681.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5491168266493116082&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7gfiPFNQyh-WWyyifOES5RAF5oetLcVKheipSbPLwNc7EcJ6vkd8Z1wx4ya0umeUrMRiv_f_fw2Zkv2C-HgBEUELHIrI9YnWbce3CHH5ditsgW6tltynO_9RgyFcMyW9F39In3VTfjCY/s1600/IMG_0677.jpg&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7gfiPFNQyh-WWyyifOES5RAF5oetLcVKheipSbPLwNc7EcJ6vkd8Z1wx4ya0umeUrMRiv_f_fw2Zkv2C-HgBEUELHIrI9YnWbce3CHH5ditsgW6tltynO_9RgyFcMyW9F39In3VTfjCY/s320/IMG_0677.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5491168114233673890&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;He tenido que hacerme unas funciones nuevas específicas para girar el motor una cantidad determinada de grados.&lt;br /&gt;&lt;br /&gt;La energia del motor la saco de la salida de 5v del arduino, pero tambien se podría meter una fuente externa, o si pusieramos mas paneles , alimentarse a si mismo y al arduino.&lt;br /&gt;&lt;br /&gt;En cuanto a la placa solar, he conectado el cable positifo la entrada analogica 0 y la otra a tierra, y así puedo leer la cantidad de energia que pilla la plaquita.&lt;br /&gt;&lt;br /&gt;Una vez montado todo esto, gracias a un superelavorado algoritmo , XD , podremos hacer que el panel gire hacia donde haya más luz. Increíble xD&lt;br /&gt;&lt;br /&gt;Aki el algoritmo para el arduino&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;int motorPin1 = 8;&lt;br /&gt;int motorPin2 = 9;&lt;br /&gt;int motorPin3 = 10;&lt;br /&gt;int motorPin4 = 11;&lt;br /&gt;&lt;br /&gt;int angle = 90;&lt;br /&gt;float val = 0; &lt;br /&gt;&lt;br /&gt;int step = 0;&lt;br /&gt;&lt;br /&gt;void derecha(int delayTime,float angulos){&lt;br /&gt;    //96 pasos de 3,75 grados son 360 grados&lt;br /&gt;    if (angulos + angle &gt; 180) return;&lt;br /&gt;    angle = angle + angulos;&lt;br /&gt;    angulos = angulos / 3,75;&lt;br /&gt;    for (int i=0; i &lt; angulos ; i++) {&lt;br /&gt;      digitalWrite(motorPin1, step==0?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin2, step==1?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin3, step==2?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin4, step==3?HIGH:LOW);&lt;br /&gt;      delay(delayTime);&lt;br /&gt;      step = (step+1)%4;&lt;br /&gt;    } &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void izquierda(int delayTime,float angulos){&lt;br /&gt;    //96 pasos de 3,75 grados son 360 grados&lt;br /&gt;    if (angle - angulos &lt; 0) return;&lt;br /&gt;    angle = angle - angulos;&lt;br /&gt;    angulos = angulos / 3,75;&lt;br /&gt;    for (int i=0; i &lt; angulos ; i++) {&lt;br /&gt;      digitalWrite(motorPin4, step==0?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin3, step==1?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin2, step==2?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin1, step==3?HIGH:LOW);&lt;br /&gt;      delay(delayTime);&lt;br /&gt;      step = (step+1)%4;&lt;br /&gt;    }  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void buscabusca(){&lt;br /&gt;float der = 0;&lt;br /&gt;float izk = 0;&lt;br /&gt;float now = 0;&lt;br /&gt;int last = 0;&lt;br /&gt;  &lt;br /&gt;  val = analogRead(0);    // lee el valor de tensión del pin&lt;br /&gt;  val = val * 6 / 1300;&lt;br /&gt;  Serial.println(val);   &lt;br /&gt;  for(;;) {&lt;br /&gt;    now = analogRead(0);&lt;br /&gt;    if (last &gt; 0){ &lt;br /&gt;      derecha(55,5);&lt;br /&gt;      der = analogRead(0);&lt;br /&gt;      Serial.print(&quot;der&quot;);&lt;br /&gt;      Serial.println(der); &lt;br /&gt;      if (abs(der - now)&lt;3) delay(1000);&lt;br /&gt;      if (der &gt; now) last = 1;&lt;br /&gt;      else last = 0;&lt;br /&gt;    } else {&lt;br /&gt;      izquierda(55,5);&lt;br /&gt;      izk = analogRead(0);&lt;br /&gt;      Serial.print(&quot;izk&quot;);&lt;br /&gt;      Serial.println(izk); &lt;br /&gt;      if (abs(izk- now)&lt;3) delay(1000);&lt;br /&gt;      if (izk &gt; now) last = 0;&lt;br /&gt;      else last = 1;&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  pinMode(motorPin1, OUTPUT);&lt;br /&gt;  pinMode(motorPin2, OUTPUT);&lt;br /&gt;  pinMode(motorPin3, OUTPUT);&lt;br /&gt;  pinMode(motorPin4, OUTPUT);&lt;br /&gt;  &lt;br /&gt;  Serial.begin(9600);          //  Inicialización del modulo Serial.&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;  buscabusca();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Como vemos , la lectura del panel, se hace por el pin analogico 0 , y los pines digitales 8,9,10,11 los usamos para mover el estepper.&lt;br /&gt;&lt;br /&gt;El programa muestra por el puerto serie información sobre lo leido , por si hay ke debugear. XD&lt;br /&gt;&lt;br /&gt;Subiría un video de como se mueve pero ya mejor ke lo averigue cada uno.&lt;br /&gt;&lt;br /&gt;Aunque si tuviera que poner un video pondría uno que he visto por youtube que se parece bastante a esto pero en mayor escala xDD&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/ATnnMFO60y8&amp;amp;hl=es_ES&amp;amp;fs=1&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/ATnnMFO60y8&amp;amp;hl=es_ES&amp;amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/1969797199119852359/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/sun-tracking-mini-edition.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/1969797199119852359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/1969797199119852359'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/sun-tracking-mini-edition.html' title='Sun tracking mini edition'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXhuHIfMEYh7yJMRZsRU-A1DPsXYHeqTz4e74X6jKZtz6Q6ZNAHcNmqav44aodlF-okmGC1OiNODubmCwWR35azqMvuz-wQhyphenhyphenUtlCkQYf8NEt9GR1OuBPw8tsQrRI0oIjYNMcXps1ND5I/s72-c/IMG_0684.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-2383374762298918063</id><published>2010-07-04T12:25:00.000-07:00</published><updated>2010-07-06T12:00:01.879-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="iniciación"/><category scheme="http://www.blogger.com/atom/ns#" term="motor"/><category scheme="http://www.blogger.com/atom/ns#" term="motor paso a paso"/><title type='text'>Motor paso a paso con arduino</title><content type='html'>Esta tarde he desmontao un scanner viejo que tenía por ahi y me he encontrado dentro con esto:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLNwJhgrpbmojO65p-EbehBCMpwiEWVtqLopynwXoK6o_MJ3rg4wkdiKIkeBtu4o0NGKTHRz5sTz4l3Do6VIAnBasa5uutMhyphenhypheneEsByg_y9egXyAm5dc0PED6vHWVoZwuxv8eifOMgU6Gc/s1600/IMG_0667.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLNwJhgrpbmojO65p-EbehBCMpwiEWVtqLopynwXoK6o_MJ3rg4wkdiKIkeBtu4o0NGKTHRz5sTz4l3Do6VIAnBasa5uutMhyphenhypheneEsByg_y9egXyAm5dc0PED6vHWVoZwuxv8eifOMgU6Gc/s320/IMG_0667.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136446938053298&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwGzE2Qmrk4nkS_IHVURN6uBiwg7ILCGhxxFtNUcRKR_ib43euXUdw_te9ryS-BVxNDT7vRC9q3M3GcxMrC6Ce4mswrm7hOj3EndoEFH25xm7VdpV_fC2pOgJIvM7e3sAlY48SMS759eI/s1600/IMG_0668.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwGzE2Qmrk4nkS_IHVURN6uBiwg7ILCGhxxFtNUcRKR_ib43euXUdw_te9ryS-BVxNDT7vRC9q3M3GcxMrC6Ce4mswrm7hOj3EndoEFH25xm7VdpV_fC2pOgJIvM7e3sAlY48SMS759eI/s320/IMG_0668.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136387102178978&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Tachaaann!! que coño es esto? verdad?&lt;br /&gt;&lt;br /&gt;pues ya me sonaban un poco asi de oidas lo de los stepper motor , o en castellano, motores paso a paso (PaP).&lt;br /&gt;&lt;br /&gt;He investigado por ahi los tipos de motores y resulta que estos tipos de motores funcionan como si tuvieran 4 imanes dentro, uno a sus 12 otro a las 3 , 6 y 9, osea, norte sur este y oeste. Entonces dependiendo de el iman que esté encendido es un paso u otro.&lt;br /&gt;&lt;br /&gt;Por ejemplo, para darle una vuelta a este motor, tendríamos que encender el motor del norte, solo, luego el del este solo, luego el del sur solo y por ultimo el del oeste solo, y norte again.&lt;br /&gt;&lt;br /&gt;voy a robar unas imagenes explicativas que me han gustao xDD&lt;br /&gt;&lt;br /&gt;&lt;img style=&quot;float: left;&quot; src=&quot;http://www.x-robotics.com/images/motorpap_a.gif&quot; alt=&quot;&quot; /&gt;&lt;img style=&quot;float: left;&quot; src=&quot;http://www.x-robotics.com/images/motorpap_b.gif&quot; alt=&quot;&quot; /&gt;&lt;img style=&quot;float: left;&quot; src=&quot;http://www.x-robotics.com/images/motorpap_c.gif&quot; alt=&quot;&quot; /&gt;&lt;img style=&quot;float: left;&quot; src=&quot;http://www.x-robotics.com/images/motorpap_d.gif&quot; alt=&quot;&quot; /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;y si queremos girar en sentido opuesto pues imagina, los enciendes en el otro sentido.&lt;br /&gt;&lt;br /&gt;También se puede hacer los giros en lugar de en 4 pasos, en 8 encendiendo tambien 2 imanes a la vez, lo cual hace que se quede en medio del A y B por ejemplo&lt;br /&gt;&lt;br /&gt;Bueno lo básico ya está claro, si tienes más interés en los motores puedes verlo en este link:&lt;br /&gt;&lt;a href=&quot;http://www.x-robotics.com/motorizacion.htm&quot;&gt;http://www.x-robotics.com/motorizacion.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Seguimos, el tema es que una vez desmontado, te vienen 5 cables y no tienes ni idea de para que es cada uno xDD&lt;br /&gt;&lt;br /&gt;En mi caso me venían 4 seguidos y uno separado, usando la lógica, el separado es para meterle los voltios y los otros cuatro son para controlar los cuatro imanes ke lleva. Así que si hay ke controlar cosas, que mejor que el multiusos chip ULN2003 que también nos había servido para el ambilight casero.&lt;br /&gt;&lt;br /&gt;He usado las primeras 4 patillas del chip para los cuatro cables de control y están conectadas a los pines 8, 9, 10,11. El de voltaje no va enchufado al chip, pero lo enchufaremos más tarde directamente a los 12v de una fuente.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqnXQvmT_XEtgegshnXNNvdMeIjZxgMCXZjtFUcjEc6CFrPdsRlO-McreajdadH57SH_VsydOaggtOd7dfwzBcX4zccTRcZbNvqCXxZP-73UdgDQgf8KiCLSec8eLPab9vyUD1jNilyEo/s1600/IMG_0670.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqnXQvmT_XEtgegshnXNNvdMeIjZxgMCXZjtFUcjEc6CFrPdsRlO-McreajdadH57SH_VsydOaggtOd7dfwzBcX4zccTRcZbNvqCXxZP-73UdgDQgf8KiCLSec8eLPab9vyUD1jNilyEo/s320/IMG_0670.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136333165866546&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0NwcGa7Xf0lFvaXCigfwg1xlKl1lCzrrWKxlugk_qJQ5hYmsxV4OD4vL2yYQPiTqtBUAxEeWaRaDY0zpmKhOeFXZzm2gGKfglEzRvMAELNWZyN83VkUuWZmDeOp9W9t2y5ClWXMXBwMY/s1600/IMG_0671.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0NwcGa7Xf0lFvaXCigfwg1xlKl1lCzrrWKxlugk_qJQ5hYmsxV4OD4vL2yYQPiTqtBUAxEeWaRaDY0zpmKhOeFXZzm2gGKfglEzRvMAELNWZyN83VkUuWZmDeOp9W9t2y5ClWXMXBwMY/s320/IMG_0671.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136281525088594&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Como se vé los colores amarillo, negro, naranja y marron son de control y el rojo es el del voltaje.&lt;br /&gt;según la &lt;a href=&quot;http://www.mitsumi.co.jp/latest/Catalog/compo/motor/m42sp4_e.html&quot;&gt;especificación del motor&lt;/a&gt; el motor se le supone ke va con 24v, pero con 12v o incluso con 5 a mi me ha ido a la misma velocidad...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSPicDY3dKjangaKelbtFYnbT0c3ux1y8umaA8ioVlOQt_LesuPkILr4k8ySUNzbidfG1_Lfy8LRj1NUsJngBSBWXfN9uHbIiKzGa-G2cV3AbtNKvb51eEzEOv-qEvrramlIjx7FpNCgs/s1600/IMG_0672.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSPicDY3dKjangaKelbtFYnbT0c3ux1y8umaA8ioVlOQt_LesuPkILr4k8ySUNzbidfG1_Lfy8LRj1NUsJngBSBWXfN9uHbIiKzGa-G2cV3AbtNKvb51eEzEOv-qEvrramlIjx7FpNCgs/s320/IMG_0672.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136229955652994&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Para terminar de hacer la gracia , he puesto el motor donde estaba y ahora manejo el carrusel del scaner con el arduino xDDD, la verdad esque me esperaba poder ponerle más velocidad, pero es lento de cojones... aunque bastante potente.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg29bZpBw20glMlWK1GLLeXP_KW2u_KnkP9vuQFx74hzm4_-x3YW8XJarl4H_7JvYA_ZOyQmmDWpjKw-qvDjPGae5j3Dw-kuWy75ZIFr9eRyE87evUJx49cwA88yJjLQE_bOR-FXaKE0Nc/s1600/IMG_0674.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg29bZpBw20glMlWK1GLLeXP_KW2u_KnkP9vuQFx74hzm4_-x3YW8XJarl4H_7JvYA_ZOyQmmDWpjKw-qvDjPGae5j3Dw-kuWy75ZIFr9eRyE87evUJx49cwA88yJjLQE_bOR-FXaKE0Nc/s320/IMG_0674.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136189380818962&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN-j3Z5M7sZKgaErvs7eGsN1ids7a_nkgTU8YGHVybXe_-rq15kMBf1TLlo66cJQ-AjsXQtvVsyuWwLDYNGQNQleVbgyLNintMJGCErKEGeHnpgtzW0hfyELVdA8S7KlbyH2Rkwo9nd9c/s1600/IMG_0675.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN-j3Z5M7sZKgaErvs7eGsN1ids7a_nkgTU8YGHVybXe_-rq15kMBf1TLlo66cJQ-AjsXQtvVsyuWwLDYNGQNQleVbgyLNintMJGCErKEGeHnpgtzW0hfyELVdA8S7KlbyH2Rkwo9nd9c/s320/IMG_0675.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490136111572315746&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Ah!, por último el código del arduino para hacer maravillas con este motor xDD&lt;br /&gt;&lt;br /&gt;PD: mi motor en concreto tiene un giro de 3 grados por cambio de fase&lt;br /&gt;&lt;br /&gt;Step Angle    &lt;div class=&quot;sentence-s&quot;&gt;3.75º/step&lt;br /&gt;&lt;br /&gt;eso pone en la DATASHEET xDD&lt;br /&gt;&lt;br /&gt;osea que por ejemplo para dar una vuelta entera deberemos cambiar de fase unas 360 / 3,75 = inicio, ejecutar, calc y nos dá un resultadod de 96 cambios&lt;br /&gt;&lt;br /&gt;en el codigo voy a hacer dos funciones, una que de una vuelta pa un lao y otra ke haga exactamente lo contrario.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int motorPin1 = 8;&lt;br /&gt;int motorPin2 = 9;&lt;br /&gt;int motorPin3 = 10;&lt;br /&gt;int motorPin4 = 11;&lt;br /&gt;&lt;br /&gt;int step = 0;&lt;br /&gt;&lt;br /&gt;// Up Down Left Right&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void derecha(int delayTime,int vueltas){&lt;br /&gt;    //96 pasos de 3,75 grados son 360 grados&lt;br /&gt;   &lt;br /&gt;    vueltas = vueltas * 96;&lt;br /&gt;    for (int i=0; i &lt; vueltas ; i++) {&lt;br /&gt;      digitalWrite(motorPin1, step==0?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin2, step==1?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin3, step==2?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin4, step==3?HIGH:LOW);&lt;br /&gt;      delay(delayTime);&lt;br /&gt;      step = (step+1)%4;&lt;br /&gt;    }&lt;br /&gt;      &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void izquierda(int delayTime,int vueltas){&lt;br /&gt;    //96 pasos de 3,75 grados son 360 grados&lt;br /&gt;   &lt;br /&gt;    vueltas = vueltas * 96;&lt;br /&gt;    for (int i=0; i &lt; vueltas ; i++) {&lt;br /&gt;      digitalWrite(motorPin4, step==0?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin3, step==1?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin2, step==2?HIGH:LOW);&lt;br /&gt;      digitalWrite(motorPin1, step==3?HIGH:LOW);&lt;br /&gt;      delay(delayTime);&lt;br /&gt;      step = (step+1)%4;&lt;br /&gt;    }&lt;br /&gt;      &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  pinMode(motorPin1, OUTPUT);&lt;br /&gt;  pinMode(motorPin2, OUTPUT);&lt;br /&gt;  pinMode(motorPin3, OUTPUT);&lt;br /&gt;  pinMode(motorPin4, OUTPUT);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;  derecha(2,1);&lt;br /&gt;  izquierda(2,1);&lt;br /&gt;   derecha(3,1);&lt;br /&gt;  izquierda(3,1);&lt;br /&gt;   derecha(4,1);&lt;br /&gt;  izquierda(4,1);&lt;br /&gt;   derecha(5,1);&lt;br /&gt;  izquierda(5,1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Y este codigo hace una vuelta pa un lao y otra pa otro xDD lo mas rápido posible, ya que si le metes un delay de 1 se vuelve loco y no se mueve xDDD&lt;br /&gt;&lt;br /&gt;OJO! Las funciones se llaman up down left y right, pero no significa que el up sea pa arriba y right sea derecha, tendría que cambiar los nombres, para hacer funciones para girar 90 grados, osea 6 cambios seguidos.&lt;br /&gt;&lt;br /&gt;Ah están hechas las funciones de los pasos diagonales, si hicieramos los 4 pasos solo con diagonales el motor sería mas powerfull ya que el motor gira con la fuerza de dos imanes por paso.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fuentes:&lt;br /&gt;&lt;a href=&quot;http://www.mitsumi.co.jp/latest/Catalog/compo/motor/m42sp4_e.html&quot;&gt;http://www.mitsumi.co.jp/latest/Catalog/compo/motor/m42sp4_e.html&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.x-robotics.com/motorizacion.htm&quot;&gt;http://www.x-robotics.com/motorizacion.htm&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.arduino.cc/en/Tutorial/StepperUnipolar&quot;&gt;http://www.arduino.cc/en/Tutorial/StepperUnipolar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/2383374762298918063/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/motor-paso-paso-con-arduino.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2383374762298918063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2383374762298918063'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/motor-paso-paso-con-arduino.html' title='Motor paso a paso con arduino'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLNwJhgrpbmojO65p-EbehBCMpwiEWVtqLopynwXoK6o_MJ3rg4wkdiKIkeBtu4o0NGKTHRz5sTz4l3Do6VIAnBasa5uutMhyphenhypheneEsByg_y9egXyAm5dc0PED6vHWVoZwuxv8eifOMgU6Gc/s72-c/IMG_0667.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-6816325645914560272</id><published>2010-07-04T05:40:00.001-07:00</published><updated>2010-07-07T07:55:05.243-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="ikea"/><category scheme="http://www.blogger.com/atom/ns#" term="led"/><category scheme="http://www.blogger.com/atom/ns#" term="rgb"/><title type='text'>Ambilight casero para PC</title><content type='html'>Holas, aquí va el segundo tema util que hacer con arduino. En este caso montaremos un ambilight casero con las tiras de leds RGB del IKEA. Personalmente no recomiendo comprarlas, no porque sean malas, todo lo contrario, funcionan perfectamente, pero son un pelin caras para mi gusto.&lt;br /&gt;&lt;br /&gt;Hay otra alternativa en &lt;a href=&quot;http://www.dealextreme.com/details.dx/sku.14965&quot;&gt;Dealextreme&lt;/a&gt;, más económica, y servirá perfectamente.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Hardware&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Las tiras de leds que tengo son así:&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDIRMsLS8J756j04hTcANbna8zrBtdp2PGtbl74wHZOz3Qlx3KdNDvqI_ZCDfAbDclh_Y7D8Gs3iYc_VPUDUVvlVbKc_RCBQfNV-iA-FUY_YMu03iqpy_Y01hGJNP6sKGilvo5WpkFq1s/s1600/IMG_0661.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDIRMsLS8J756j04hTcANbna8zrBtdp2PGtbl74wHZOz3Qlx3KdNDvqI_ZCDfAbDclh_Y7D8Gs3iYc_VPUDUVvlVbKc_RCBQfNV-iA-FUY_YMu03iqpy_Y01hGJNP6sKGilvo5WpkFq1s/s320/IMG_0661.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030577009232978&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrWDriQ706D9w51tSQaVIPDsJSPvWuI3FBQUfWkBLJNZz-oRlWlUjZXMdkIuchLpQ_Ez8sZJ7XBGroNbAVKTxkLLK99MedXr1M1XR01eTQ_-bNHYozHeyOuzo075Le2Mu1dyHRHPF3988/s1600/IMG_0662.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrWDriQ706D9w51tSQaVIPDsJSPvWuI3FBQUfWkBLJNZz-oRlWlUjZXMdkIuchLpQ_Ez8sZJ7XBGroNbAVKTxkLLK99MedXr1M1XR01eTQ_-bNHYozHeyOuzo075Le2Mu1dyHRHPF3988/s320/IMG_0662.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030495349397538&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Cada tira tiene 4 conectores, uno para cada canal R, G y B (Rojo, Verde  y Azul) y un cuarto por donde le entran los 12v que pide.&lt;br /&gt;&lt;br /&gt;Tenemos que fijarnos si hay alguna leyenda por las tiras donde lo indique ya que en mi caso, el orden está cambiado y es RBG en lugar de RGB, la W será de power.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4VdLn2VO0ErAj7IumOo_GwcbOkxvsJZHqbDlMBQI-ADZNSo-2H7Uq-6BrzN4BJ08Fi3SOCCthm_XVPWVevCH9ZVXK9dJqyTWQxKYvfAYxrdBBKKcsADk1KcS865m5se-X4cn5wjIgQEQ/s1600/IMG_0663.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4VdLn2VO0ErAj7IumOo_GwcbOkxvsJZHqbDlMBQI-ADZNSo-2H7Uq-6BrzN4BJ08Fi3SOCCthm_XVPWVevCH9ZVXK9dJqyTWQxKYvfAYxrdBBKKcsADk1KcS865m5se-X4cn5wjIgQEQ/s320/IMG_0663.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030442041039410&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;En cuanto al circuito necesario para que funcione la cosa, aquí pongo un esquema hecho a mano para que quede clara la cosa.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoSq3YZYBmI29vdqQ8cpiIyD7vPU_PAJ4Ydqr7rJE9SrZGpJXhp4wCWx2oAL1dirIA8TO8UnThonqGu2klHncqfxbJ9GTWHtkuOq9e5V6wtuAuWlaRzjMjfxEt_ZFG_4PN39Kpk12TjlM/s1600/IMG_0664.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgoSq3YZYBmI29vdqQ8cpiIyD7vPU_PAJ4Ydqr7rJE9SrZGpJXhp4wCWx2oAL1dirIA8TO8UnThonqGu2klHncqfxbJ9GTWHtkuOq9e5V6wtuAuWlaRzjMjfxEt_ZFG_4PN39Kpk12TjlM/s320/IMG_0664.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030385634213474&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Como se puede apreciar, usamos un chip ULN2003 para controlar la potencia que pasa por los distintos canales.&lt;br /&gt;&lt;br /&gt;Este chip soporta bien los 12v pero está limitado a 0.5A de salida, así que asegurate que las tiras de leds no consumen más de eso si no quieres salir ardiendo XDD&lt;br /&gt;&lt;br /&gt;El resto es simplemente conectar a las salidas PWM de arduino por un lado y por el otro a las tiras de leds.&lt;br /&gt;&lt;br /&gt;Los 12v se los meteremos a ambas tiras directamente por su pin.&lt;br /&gt;&lt;br /&gt;Las X marcadas significa que no se usan.&lt;br /&gt;&lt;br /&gt;Una vez montado en una placa prototipo o en un proto shield (como es mi caso) nos quedará algo como esto&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxKSINnRHevxN39VAimkqOzeaZFcwzzkrUn1SWMehJN-8cik_0hyKtwu_hEBqn5o2knKBrDXDgUY2IyzMrOT_MDNCyF9BOdC07A6d8P5aEjKhbFnAnMCH19Hg2QyrMo7s8EfniKYdXK6A/s1600/IMG_0655.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxKSINnRHevxN39VAimkqOzeaZFcwzzkrUn1SWMehJN-8cik_0hyKtwu_hEBqn5o2knKBrDXDgUY2IyzMrOT_MDNCyF9BOdC07A6d8P5aEjKhbFnAnMCH19Hg2QyrMo7s8EfniKYdXK6A/s320/IMG_0655.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030136617537426&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA7WpBep8DWWxS5BysPa7IOc3T054dGUGog78DoEZehe0bSxWZoHB-KKWxbZ_u1PzyoOsiLA-TDx1NnDeMk3PyRNYHJxyq6mO92Zz1SiMP2NKu4OKsC_mCnkjvUFICThS5cdRMBXMxTh4/s1600/IMG_0658.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA7WpBep8DWWxS5BysPa7IOc3T054dGUGog78DoEZehe0bSxWZoHB-KKWxbZ_u1PzyoOsiLA-TDx1NnDeMk3PyRNYHJxyq6mO92Zz1SiMP2NKu4OKsC_mCnkjvUFICThS5cdRMBXMxTh4/s320/IMG_0658.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030235806368050&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;El interruptor y las resistencias y tal podeis ignorarlas porque no son parte de esto, solo son para poder resetear el arduino con el shiel montado&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWstSPo2rclaRO0mRY-KEjjny0FhOEkGKJg3aPOH8hyI6DwUu-5mMHW67RLwIru5SZnawalsV90PfrIEJndVsPdW78T7jVY_NR9wjRUmcz2kJ__CoOItX6Nk7cLMItD259SsjohIHzHi8/s1600/IMG_0659.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWstSPo2rclaRO0mRY-KEjjny0FhOEkGKJg3aPOH8hyI6DwUu-5mMHW67RLwIru5SZnawalsV90PfrIEJndVsPdW78T7jVY_NR9wjRUmcz2kJ__CoOItX6Nk7cLMItD259SsjohIHzHi8/s320/IMG_0659.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490030680490371362&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Software&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;En cuanto a la parte de programar el arduino, debemos cargar el siguiente programa:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:monospace;&quot;&gt;&lt;newsoftserial.h&gt;&lt;channelcount; reset=&quot;&quot; all=&quot;&quot; channels=&quot;&quot; channel=&quot;&quot; pin=&quot;&quot; debug=&quot;&quot; setup=&quot;&quot; endif=&quot;&quot; continuously=&quot;&quot; looks=&quot;&quot; to=&quot;&quot; the=&quot;&quot; serial=&quot;&quot; port=&quot;&quot; if=&quot;&quot; there=&quot;&quot; is=&quot;&quot; data=&quot;&quot; processes=&quot;&quot; it=&quot;&quot; void=&quot;&quot; word=&quot;&quot; byte=&quot;&quot; for=&quot;&quot; int=&quot;&quot; i=&quot;0;&quot;&gt;&lt;channelcount; val=&quot;channels[i];&quot; high=&quot;val&quot;&gt;&lt;channelcount; reset=&quot;&quot; all=&quot;&quot; channels=&quot;&quot; void=&quot;&quot; int=&quot;&quot; numchannels=&quot;Serial.read();&quot; debug=&quot;&quot; request=&quot;&quot; current=&quot;&quot; values=&quot;&quot; endif=&quot;&quot; if=&quot;&quot; startchannel=&quot;Serial.read();&quot;&gt;// This sketch translates Boblight commands to control RGB LEDs via PWM.&lt;br /&gt;// Implements LTBL serial protocol (http://blogger.xs4all.nl/loosen/articles/420470.aspx)&lt;br /&gt;// 2009-11-27 (c) Szymon Kobalczyk (http://geekswithblogs.net/kobush/)&lt;br /&gt;// http://opensource.org/licenses/mit-license.php&lt;br /&gt;&lt;br /&gt;#define DEBUG 0 // set to 1 to send debug to SoftSerial (2,4)&lt;br /&gt;&lt;br /&gt;#define checkByte1 0x55&lt;br /&gt;#define checkByte2 0xAA&lt;br /&gt;&lt;br /&gt;int ledPin = 13; // debug led&lt;br /&gt;&lt;br /&gt;#define channelCount 6&lt;br /&gt;word channels[channelCount];   // holds current color values&lt;br /&gt;int channelPins[channelCount] = { 6, 3, 5, 11, 9, 10 }; // PWM pins to control LED strips (2x RGB)&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;#include &lt;newsoftserial.h&gt;&lt;br /&gt;int rxPin = 2;&lt;br /&gt;int txPin = 4;&lt;br /&gt;NewSoftSerial xSerial(rxPin, txPin);&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  digitalWrite(ledPin, HIGH); // say we&#39;re alive&lt;br /&gt;&lt;br /&gt;  Serial.begin(9600); // open serial&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.begin(57600);&lt;br /&gt;  xSerial.print(&quot;[boblight] &quot;);&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;  for (int i =0; i &lt; channelCount; i++)&lt;br /&gt;  {&lt;br /&gt;    channels[i] = 0;   // reset all channels&lt;br /&gt;    pinMode(channelPins[i], OUTPUT); // setup channel pin&lt;br /&gt;  }&lt;br /&gt;  setLight();&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.println(&quot;Setup finished.&quot;);&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;  digitalWrite(ledPin, LOW);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop()&lt;br /&gt;{&lt;br /&gt;  // continuously looks to the serial port&lt;br /&gt;  // if there is data it processes it&lt;br /&gt;  pollSerialPort();            &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void setLight() {&lt;br /&gt;  word val;&lt;br /&gt;  byte high, low;&lt;br /&gt;  for (int i=0; i &lt; channelCount; i++)&lt;br /&gt;  {&lt;br /&gt;    val  = channels[i];&lt;br /&gt;    high = val &gt;&gt; 8;&lt;br /&gt;    //low  = val &amp;amp; 0xFF;&lt;br /&gt;    analogWrite(channelPins[i], high);&lt;br /&gt;  &lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.print(channelPins[i]);&lt;br /&gt;  xSerial.print(&quot;:&quot;);&lt;br /&gt;  xSerial.print(high, DEC);&lt;br /&gt;  xSerial.print(&quot; &quot;);&lt;br /&gt;#endif&lt;br /&gt;  }&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.println();&lt;br /&gt;#endif &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// process incoming data&lt;br /&gt;void pollSerialPort() {&lt;br /&gt;  int data;&lt;br /&gt;  if (Serial.available() &gt;= 4) {     // if at least 4 bytes are in the buffer&lt;br /&gt;    data = Serial.read();&lt;br /&gt;    echo(data);&lt;br /&gt;    if (data == checkByte1) {        // check first prefix byte 0x55&lt;br /&gt;      data = Serial.read();&lt;br /&gt;      echo(data);&lt;br /&gt;      if (data == checkByte2) {      // check second prefix byte 0xAA&lt;br /&gt;        digitalWrite(ledPin, LOW);   // signal prefix recognized&lt;br /&gt;        data = Serial.read();&lt;br /&gt;        if (data &lt; 127)&lt;br /&gt;          readChannels(data);&lt;br /&gt;        else&lt;br /&gt;          readCommand(data);&lt;br /&gt;       &lt;br /&gt;        return;&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;    // error&lt;br /&gt;    digitalWrite(ledPin, HIGH);     // signal unrecognized sequence&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void echo(int data) {&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.print((byte)data, HEX);&lt;br /&gt;  xSerial.print(&quot; &quot;);&lt;br /&gt;#endif&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void readChannels(int startChannel) {&lt;br /&gt;  int numChannels = Serial.read();&lt;br /&gt;&lt;br /&gt;  // wait for all data to come in (expecting 2 bytes per channel)&lt;br /&gt;  while (Serial.available() &lt; numChannels * 2)&lt;br /&gt;    delay(10);&lt;br /&gt; &lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.print(&quot;SET: &quot;);&lt;br /&gt;//  xSerial.print(&quot;Reading channels &quot;);&lt;br /&gt;//  xSerial.print(startChannel, DEC);&lt;br /&gt;//  xSerial.print(&quot; &quot;);&lt;br /&gt;//  xSerial.print(numChannels, DEC);&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;  byte high, low;&lt;br /&gt;  word val;&lt;br /&gt;  for (int i = 0; i &lt; numChannels; i++)&lt;br /&gt;  {&lt;br /&gt;    high = Serial.read();  // echo(high);&lt;br /&gt;    low  = Serial.read();   // echo(low);&lt;br /&gt;    val  = word(high, low);&lt;br /&gt;&lt;br /&gt;    if (startChannel+i &lt; channelCount)&lt;br /&gt;      channels[startChannel+i] = val;&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.print(high, DEC);&lt;br /&gt;  xSerial.print(&quot; &quot;);&lt;br /&gt;#endif&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.println();&lt;br /&gt;#endif&lt;br /&gt;&lt;br /&gt;  // apply changes&lt;br /&gt;  setLight();                                   &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void readCommand(int command) {&lt;br /&gt;  int numBytes = Serial.read();&lt;br /&gt;&lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.print(&quot;Reading command &quot;);&lt;br /&gt;  xSerial.print(command, HEX);&lt;br /&gt;  xSerial.print(&quot; &quot;);&lt;br /&gt;  xSerial.print(numBytes, DEC);&lt;br /&gt;#endif&lt;br /&gt; &lt;br /&gt;  if (command == 0x81) // request current values&lt;br /&gt;  {&lt;br /&gt;    requestValues();&lt;br /&gt;  }&lt;br /&gt;  else if (command == 0x83) // open light&lt;br /&gt;  {&lt;br /&gt;    setLight();                                   &lt;br /&gt;  }&lt;br /&gt;  else if (command == 0x84)   // close light&lt;br /&gt;  {&lt;br /&gt;    for (int i =0; i&lt;channelCount; i++) {&lt;br /&gt;      channels[i] = 0;       // reset all channels&lt;br /&gt;    }&lt;br /&gt;    setLight();                                   &lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;#if DEBUG&lt;br /&gt;  xSerial.println();&lt;br /&gt;#endif&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void requestValues()&lt;br /&gt;{&lt;br /&gt;    int startChannel = Serial.read();&lt;br /&gt;    int numChannels =  Serial.read();&lt;br /&gt;&lt;br /&gt;#if DEBUG   &lt;br /&gt;    xSerial.print(&quot; request current values &quot;);&lt;br /&gt;    xSerial.print(startChannel, DEC);&lt;br /&gt;    xSerial.print(&quot; &quot;);&lt;br /&gt;    xSerial.print(numChannels, DEC);&lt;br /&gt;#endif   &lt;br /&gt;    Serial.print(checkByte1, BYTE);&lt;br /&gt;    Serial.print(checkByte2, BYTE);&lt;br /&gt;   &lt;br /&gt;    if (startChannel &gt;= channelCount || numChannels &lt;=0)&lt;br /&gt;    {&lt;br /&gt;      // no data to send&lt;br /&gt;      Serial.print(0, BYTE);&lt;br /&gt;      Serial.print(0, BYTE);&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;      numChannels = min(channelCount - startChannel, numChannels);&lt;br /&gt;      Serial.print(startChannel, BYTE);&lt;br /&gt;      Serial.print(numChannels, BYTE);&lt;br /&gt;    &lt;br /&gt;      byte high, low;&lt;br /&gt;      word val;&lt;br /&gt;      for (int i=startChannel; i &lt; startChannel + numChannels; i++)&lt;br /&gt;      {&lt;br /&gt;         val = channels[i];&lt;br /&gt;      high = val &gt;&gt; 8;&lt;br /&gt;         low  = val &amp;amp; 0xFF;&lt;br /&gt;         Serial.print(high, BYTE);&lt;br /&gt;         Serial.print(low, BYTE);&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;}&lt;newsoftserial.h&gt;&lt;channelcount; reset=&quot;&quot; all=&quot;&quot; channels=&quot;&quot; channel=&quot;&quot; pin=&quot;&quot; debug=&quot;&quot; setup=&quot;&quot; endif=&quot;&quot; continuously=&quot;&quot; looks=&quot;&quot; to=&quot;&quot; the=&quot;&quot; serial=&quot;&quot; port=&quot;&quot; if=&quot;&quot; there=&quot;&quot; is=&quot;&quot; data=&quot;&quot; processes=&quot;&quot; it=&quot;&quot; void=&quot;&quot; word=&quot;&quot; byte=&quot;&quot; for=&quot;&quot; int=&quot;&quot; i=&quot;0;&quot;&gt;&lt;channelcount; val=&quot;channels[i];&quot; high=&quot;val&quot;&gt;&lt;channelcount; reset=&quot;&quot; all=&quot;&quot; channels=&quot;&quot; void=&quot;&quot; int=&quot;&quot; numchannels=&quot;Serial.read();&quot; debug=&quot;&quot; request=&quot;&quot; current=&quot;&quot; values=&quot;&quot; endif=&quot;&quot; if=&quot;&quot; startchannel=&quot;Serial.read();&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/channelcount;&gt;&lt;/channelcount;&gt;&lt;/channelcount;&gt;&lt;/newsoftserial.h&gt;&lt;/channelcount;&gt;&lt;/channelcount;&gt;&lt;/channelcount;&gt;&lt;/newsoftserial.h&gt;&lt;/span&gt;Eso por parte de arduino.&lt;br /&gt;&lt;br /&gt;Por otra parte debemos configurar un programa llamado boblight en el pc, que es el que se encarga de mirar los colores que hay en la pantalla e indicarle al arduino por el puerto serie cuales debe mostrar por las tiras de colores izquierda y derecha.&lt;br /&gt;&lt;pre&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilD2ZUFMghQ3WzeSv_Fv11gGa1AFgxQJN_4f-pC-K5LKus0U9T-ahX6St3FOoC4XsKdSL1mr3uisjEigUrwiwfOCRo2tmYjYoGQbdszh79V8hp6v_f7KXdkElUlqvZ0saJwqNOgNS9aac/s1600/Untitled-1.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 135px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilD2ZUFMghQ3WzeSv_Fv11gGa1AFgxQJN_4f-pC-K5LKus0U9T-ahX6St3FOoC4XsKdSL1mr3uisjEigUrwiwfOCRo2tmYjYoGQbdszh79V8hp6v_f7KXdkElUlqvZ0saJwqNOgNS9aac/s320/Untitled-1.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5490049417806000242&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/pre&gt;El programa consta de 2 ejecutables, uno rojo y otro verde, hay ke ejecutar el rojo y luego el verde.&lt;br /&gt;&lt;br /&gt;El punto interesante aquí es el fichero de configuración boblight.conf. En este fichero deberemos configurar lo siguiente:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[device]&lt;br /&gt;name  ambilight&lt;br /&gt;type  LTBL&lt;br /&gt;output  &quot;com11&quot;&lt;br /&gt;rate  9600&lt;br /&gt;channels 6&lt;br /&gt;interval 10000&lt;br /&gt;&lt;/pre&gt;Como vemos, yo lo tengo configurado para que se comunique con el arduino por el com11, este habrá que cambiarlo al que uses. Puedes saber cual usas desde el compilador de arduino, Tools &gt; &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_57&quot;&gt;Serial&lt;/span&gt; &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_58&quot;&gt;port&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;En cuanto al resto de fichero, podemos &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_59&quot;&gt;trastearlo&lt;/span&gt; &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_60&quot;&gt;también&lt;/span&gt; un poquito para que nuestro &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_61&quot;&gt;ambilight&lt;/span&gt; tenga unos colores más parecidos a los de la pantalla, por ejemplo:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[color]&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_62&quot;&gt;name&lt;/span&gt;  red&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_63&quot;&gt;rgb&lt;/span&gt;  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_64&quot;&gt;FF&lt;/span&gt;0000&lt;br /&gt;gamma  1.0&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_65&quot;&gt;adjust&lt;/span&gt;  1.0&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_66&quot;&gt;blacklevel&lt;/span&gt; 0.0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;En este texto &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_67&quot;&gt;configuramos&lt;/span&gt; tanto el color Rojo como sus &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_68&quot;&gt;intensidades&lt;/span&gt;, a veces puede ser que la tira de &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_69&quot;&gt;leds&lt;/span&gt; se vea demasiado rojizo y podemos ajustarlo &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_70&quot;&gt;bajandole&lt;/span&gt; el &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_71&quot;&gt;adjust&lt;/span&gt;, 1.0 = 100% de potencia, &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_72&quot;&gt;así&lt;/span&gt; si le &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_73&quot;&gt;keremos&lt;/span&gt; bajar un poco ponemos 0.8 o así&lt;br /&gt;&lt;br /&gt;Otro punto interesante son los dos &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_74&quot;&gt;últimos&lt;/span&gt; trozos&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_75&quot;&gt;light&lt;/span&gt;]&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_76&quot;&gt;name&lt;/span&gt;  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_77&quot;&gt;left&lt;/span&gt;&lt;br /&gt;color  red  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_78&quot;&gt;ambilight&lt;/span&gt; 1&lt;br /&gt;color  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_79&quot;&gt;green&lt;/span&gt;  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_80&quot;&gt;ambilight&lt;/span&gt; 2&lt;br /&gt;color  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_81&quot;&gt;blue&lt;/span&gt;  &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_82&quot;&gt;ambilight&lt;/span&gt; 3&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_83&quot;&gt;hscan&lt;/span&gt;  0 50&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_84&quot;&gt;vscan&lt;/span&gt;  12 88&lt;br /&gt;&lt;br /&gt;[&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_85&quot;&gt;light&lt;/span&gt;]&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_86&quot;&gt;name&lt;/span&gt;            &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_87&quot;&gt;right&lt;/span&gt;&lt;br /&gt;color           red     &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_88&quot;&gt;ambilight&lt;/span&gt; 4&lt;br /&gt;color           &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_89&quot;&gt;green&lt;/span&gt;   &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_90&quot;&gt;ambilight&lt;/span&gt; 5&lt;br /&gt;color           &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_91&quot;&gt;blue&lt;/span&gt;    &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_92&quot;&gt;ambilight&lt;/span&gt; 6&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_93&quot;&gt;hscan&lt;/span&gt;           50 100&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_94&quot;&gt;vscan&lt;/span&gt;           12 88&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_95&quot;&gt;hscan&lt;/span&gt; es el la superficie horizontal que vamos a tomar referencia para esa tira de colores, y la &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_96&quot;&gt;vscan&lt;/span&gt; es la superficie vertical. En el caso de la primera luz, estamos tomando del 0% al 50% de la pantalla en horizontal, y del 12% al 88% en vertical ( el vertical está recortado para que no tome en cuenta las barras negras de las &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_97&quot;&gt;películas&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Una vez montado todo, cualquier cosa que tengas en la pantalla estará &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_98&quot;&gt;representado&lt;/span&gt; por el &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_99&quot;&gt;ambishield&lt;/span&gt;, aunque sea el propio escritorio.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_100&quot;&gt;Link&lt;/span&gt; de mi &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_101&quot;&gt;boblight&lt;/span&gt; &lt;a href=&quot;http://www.megaupload.com/?d=7A8RMLFX&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_102&quot;&gt;aqui&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;http://www.megaupload.com/?d=7A8RMLFX&lt;br /&gt;&lt;br /&gt;Os porngo un video robado de otra persona para que veais como queda.&lt;br /&gt;&lt;br /&gt;&lt;object height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/MBUD_yQtcSY&amp;amp;hl=es_ES&amp;amp;fs=1&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/MBUD_yQtcSY&amp;amp;hl=es_ES&amp;amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;/embed&gt;&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/6816325645914560272/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/ambilight-casero-para-pc.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6816325645914560272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/6816325645914560272'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/ambilight-casero-para-pc.html' title='Ambilight casero para PC'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDIRMsLS8J756j04hTcANbna8zrBtdp2PGtbl74wHZOz3Qlx3KdNDvqI_ZCDfAbDclh_Y7D8Gs3iYc_VPUDUVvlVbKc_RCBQfNV-iA-FUY_YMu03iqpy_Y01hGJNP6sKGilvo5WpkFq1s/s72-c/IMG_0661.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-2731076160289592546</id><published>2010-07-03T04:41:00.000-07:00</published><updated>2010-07-06T12:01:45.381-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arduino"/><category scheme="http://www.blogger.com/atom/ns#" term="dd-wrt"/><category scheme="http://www.blogger.com/atom/ns#" term="fonera"/><category scheme="http://www.blogger.com/atom/ns#" term="mod"/><category scheme="http://www.blogger.com/atom/ns#" term="puerto serie"/><category scheme="http://www.blogger.com/atom/ns#" term="ventilador"/><title type='text'>Enfriando la fonera</title><content type='html'>Ayer me decidí a trastear la maravillosa fonera que tenía ahi sin usar, y pensé, voy a tunearla para conectarla al arduino, y así me ahorro tener un wifi y ethernet shield.&lt;br /&gt;&lt;br /&gt;La cosa iba bien , estuve buscando información y tal. Hay bastante información de hacer esto por ahí, pero el tema es que tuve que ir tomando cachitos de varios sitios para poder montarlo todo.&lt;br /&gt;&lt;br /&gt;Ah , y cuando lo tenía todo montado, me daba cosa tener la fonera encendida más de 1 hora porque las temperaturas que alcanzaba eran tremendas, así que busqué por ahi y tb solucioné el tema de la temperatura.&lt;br /&gt;&lt;br /&gt;Pondré los pasos que he seguido para tener la cosa ya montada:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Flashear la fonera&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Este paso no tiene mucha complicación ya que solo es seguir un tutorial que hay por ahi para instalarle el dd-wrt&lt;br /&gt;&lt;br /&gt;Podeis encontrarlo aki :&lt;br /&gt;&lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/LaFonera_Software_Flashing&quot;&gt;http://www.dd-wrt.com/wiki/index.php/LaFonera_Software_Flashing&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Como comentario diré , que tardé unas horas largas&lt;br /&gt;&lt;br /&gt;Mi fonera en concreto es la vieja, la primer, el modelo 2100, y encima cuando la resetee, llevaba el firmware &lt;span class=&quot;mw-headline&quot;&gt;0.7.1 r1  por lo tanto me tocó la via facil.&lt;br /&gt;&lt;br /&gt;Lo que mola esque ahora que la tengo ya&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt; flasheada, puedo acceder a ella facilmente por el putty (192.168.1.1) y tener un shell ahi a&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt; mi disposicion&lt;br /&gt;&lt;br /&gt;PD: como dato extra, para acceder por ssh, te puedes rayar bastante, porque el login y pass es simplemente login: root, y contraseñ&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;a la que tengas configurada en la admi&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;nistración del router.&lt;br /&gt;Digo esto porque yo le cambié la pass a la fonera, yaque las que venían por defecto (root/admin) eran muy evidentes, y le puse (arduino/arduin&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;o), pues por ssh, aunque el user sea arduino hay ke entrar como root...&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mw-headline&quot;&gt;&lt;br /&gt;Una vez hecho esto, cuando accedo por el navegador al 192.168.1.1 me sale la administración del dd-wrt, y yastá listo. Supongo que pa&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;ra que el arduino se conecte a internet, deberémos configurar la fonera para ke sea clie&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;nte de otra wifi, pero eso ya lo veremos otro dia xD.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Sacar cables&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;mw-headline&quot;&gt;Para que el arduin&lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;o se conecte con la fonera , irremediablemente deberá estar conectada a esta mediante cables, puesla cosa &lt;/span&gt;&lt;span class=&quot;mw-headline&quot;&gt;está bien sencilla.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfo49mbt9gfc7TM3sTWCaCTfDMPT_H0e55tgEX_IzI_2RlpQr-0FgNyYFiw-DZ1kKtSxKEBF-qqXbXnKhhcV2ZaW5KC7pnwx_kQ-IuogUAvPrmfVARKPiZv8dVqinjt5yM_d2caPkwGJY/s1600/IMG_0642_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfo49mbt9gfc7TM3sTWCaCTfDMPT_H0e55tgEX_IzI_2RlpQr-0FgNyYFiw-DZ1kKtSxKEBF-qqXbXnKhhcV2ZaW5KC7pnwx_kQ-IuogUAvPrmfVARKPiZv8dVqinjt5yM_d2caPkwGJY/s320/IMG_0642_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489649821238619362&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Abrimos la fonera y buscamos estos pines, sólo necesitaremos 4 de ellos , aunque el de lso 3,3v no se usa para nada pero puede servir xDD.&lt;br /&gt;&lt;br /&gt;El Tx y el Rx se conectan al Tx y Rx del arduino, según he leido por ahi, a veces es al reves, el T al T y el R al R o de la otra forma, es cuestión de probar.&lt;br /&gt;&lt;br /&gt;Para facilitar la conexión me he pillado un par de cables que ya tenían sus conectores hembra, pero como era demasiado largo he tenido ke doblar las patas como se ve en la imagen para que quepa.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;La verdad esque una vez montados los cables, han kedado bastante bien.&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaKJ8Y_ggcWE6PPdrpZ3hXupMHuHoFml-CoZl_guCcwwX9cmUP2JRymd9CLS89s8Vgy2AjzTKpB5e_SFrIQyJge-qCcNZtHsRM6XGjT_tGw0KzQ3YLm0BWr-umln8mlo0S8o_HZlFhfpA/s1600/IMG_0645_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaKJ8Y_ggcWE6PPdrpZ3hXupMHuHoFml-CoZl_guCcwwX9cmUP2JRymd9CLS89s8Vgy2AjzTKpB5e_SFrIQyJge-qCcNZtHsRM6XGjT_tGw0KzQ3YLm0BWr-umln8mlo0S8o_HZlFhfpA/s320/IMG_0645_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489651383515045922&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht8ctxrmE2atUxb5s8pkLWaC4ZBZiI4EXCYBd1Rzkz5wcFRyMveGkvNQVDumPbElEGyc2R7mN60gYTm5lHlWdXo0kOEpX78L1XN-cR9XVq-oFVdc_yicTGpxQy1fMvKJ-uamVP6cerr-I/s1600/IMG_0646_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEht8ctxrmE2atUxb5s8pkLWaC4ZBZiI4EXCYBd1Rzkz5wcFRyMveGkvNQVDumPbElEGyc2R7mN60gYTm5lHlWdXo0kOEpX78L1XN-cR9XVq-oFVdc_yicTGpxQy1fMvKJ-uamVP6cerr-I/s320/IMG_0646_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489651659814545602&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A la derecha se puede ver el conector que he hecho para pichar en el arduino, de los otros dos cables solo se necesita enchufar al arduino el de tierra.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Enchufarle un ventilador&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Como el problema de temperatura era palpablemente evidente, ponerle un ventilador es necesario si no queremos tener riesgo de incendio... yo lo he montado así&lt;br /&gt;&lt;br /&gt;buscamos los 5v de la placa y le soldamos un par de cables ahi para la alimentación del ventilador. Por cierto, el ventilador lo he pillao de 5v, ke los de 12 van muy lentillos aa 5v&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoTg1Z1RnML7YCUHFpRfhF4_JPzBy4YcpBtAKzEWJRqn8qli5OlDOEeEoZhV1GLLOJlLE93W7el-mdA19gv_mNy3GJqxImSBp1nI0R8aJnrIuWYUhyphenhyphenDxn68FEKvd-YBUdq3A0aXfu8AYc/s1600/IMG_0647_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoTg1Z1RnML7YCUHFpRfhF4_JPzBy4YcpBtAKzEWJRqn8qli5OlDOEeEoZhV1GLLOJlLE93W7el-mdA19gv_mNy3GJqxImSBp1nI0R8aJnrIuWYUhyphenhyphenDxn68FEKvd-YBUdq3A0aXfu8AYc/s320/IMG_0647_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489653356643654690&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheBoPmCeP5Do5CrxcUR6Ec90HqYdJkAmrk1YlM_U0umLQv9th3yeuhszdJ5vbkuacFwYAwTyXDDwVgLwzlbLnBOpD4R9SQ1WWmMLkW-pXP4KxcHd_8tjA5-ZXaNitBsfJvfyN5yWF_m_U/s1600/IMG_0648_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheBoPmCeP5Do5CrxcUR6Ec90HqYdJkAmrk1YlM_U0umLQv9th3yeuhszdJ5vbkuacFwYAwTyXDDwVgLwzlbLnBOpD4R9SQ1WWmMLkW-pXP4KxcHd_8tjA5-ZXaNitBsfJvfyN5yWF_m_U/s320/IMG_0648_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489653685408004818&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Una vez sacados los cables los soldamos con los del ventilador y listo, en mi caso, un dia se me ocurrión la inteligente idea de ponerle un antirobo a la fonera, cosa que no me ha venido bien ahora porque el espacio para el ventilador es escaso, peeeero, cosas del karma, he pillado un ventilador perfecto tanto por espacio como por disposición de este en la fonera, ya que pilla justo encima del minidisipador que tiene XDDD&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7-Vhdgjl2gVRgHI5WV88QihmxRCkiZfwI_7MKF99IxBEAGKa_b14o0amf98BUoVUfEpo4s_-OCHp4AgsGd8od3ogKyL7fkv0AJMrwoHvwqwdsiTuxJOmSBI-F0tS-U4J-6MyFwxu2B7A/s1600/IMG_0649_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7-Vhdgjl2gVRgHI5WV88QihmxRCkiZfwI_7MKF99IxBEAGKa_b14o0amf98BUoVUfEpo4s_-OCHp4AgsGd8od3ogKyL7fkv0AJMrwoHvwqwdsiTuxJOmSBI-F0tS-U4J-6MyFwxu2B7A/s320/IMG_0649_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489655011422536626&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEkMGvOWoXAa7OpHwurbmsNEVFsaXwS4yasDWqrMXIBputKRD_j22rdrdSjLUTXlXS9TIBWqPOXGiwJhsrfYlyLgtxEO5dsOdLwBAr7OFl1sLpoG52UajJr8bnAsImKCPxfY_aRwqjuJY/s1600/IMG_0651_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEkMGvOWoXAa7OpHwurbmsNEVFsaXwS4yasDWqrMXIBputKRD_j22rdrdSjLUTXlXS9TIBWqPOXGiwJhsrfYlyLgtxEO5dsOdLwBAr7OFl1sLpoG52UajJr8bnAsImKCPxfY_aRwqjuJY/s320/IMG_0651_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489655184726858834&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Si, el recorte del bujero es super cutre, pero da igual, funciona perfectamente&lt;br /&gt;&lt;br /&gt;XDD&lt;br /&gt;&lt;br /&gt;Tachannn!!!&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqfvsbHvk6x056fyGzw6qNJFbNdmsNwd691HIneNcLrYJ_OXtsiXXYEyeYUOvYAG4Md7nSfT1Va3MLRbTtPD1DyvKXzKn-ae9DZjXRlDFVFUXxfqdk75gr7fc6jlLuQ3mpvmwYGsABh8M/s1600/IMG_0653_.jpg&quot;&gt;&lt;img style=&quot;margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 240px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqfvsbHvk6x056fyGzw6qNJFbNdmsNwd691HIneNcLrYJ_OXtsiXXYEyeYUOvYAG4Md7nSfT1Va3MLRbTtPD1DyvKXzKn-ae9DZjXRlDFVFUXxfqdk75gr7fc6jlLuQ3mpvmwYGsABh8M/s320/IMG_0653_.jpg&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489655728141557010&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ahora sólo queda la parte del arduino ya que la fonera no hay ke tocarle ya nada hardware. lista y en marcha&lt;br /&gt;&lt;br /&gt;PD: la fonera está fria. xDD&lt;br /&gt;&lt;br /&gt;Fuentes:&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/LaFonera_Software_Flashing&quot;&gt;http://www.dd-wrt.com/wiki/index.php/LaFonera_Software_Flashing&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/LaFonera_Hardware_Cooling-System&quot;&gt;http://www.dd-wrt.com/wiki/index.php/LaFonera_Hardware_Cooling-System&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://www.sherkhan.net/blogs/frikadas/?p=420&quot;&gt;http://www.sherkhan.net/blogs/frikadas/?p=420&lt;/a&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/2731076160289592546/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/enfriando-la-fonera.html#comment-form' title='1 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2731076160289592546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/2731076160289592546'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/enfriando-la-fonera.html' title='Enfriando la fonera'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfo49mbt9gfc7TM3sTWCaCTfDMPT_H0e55tgEX_IzI_2RlpQr-0FgNyYFiw-DZ1kKtSxKEBF-qqXbXnKhhcV2ZaW5KC7pnwx_kQ-IuogUAvPrmfVARKPiZv8dVqinjt5yM_d2caPkwGJY/s72-c/IMG_0642_.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3817665187453699659.post-7332990062402369716</id><published>2010-07-02T20:08:00.000-07:00</published><updated>2010-07-06T12:03:26.061-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="meta"/><title type='text'>Presentación del blog</title><content type='html'>Hola, este blog, tendrá como misión la recopilación detallada de las diversas chorradas o ingenios que logremos con nuestros arduinos. Somos un grupo de amigos los que iremos publicando entradas aquí e intentaremos que las cosas queden bien detalladas por si en un futuro se nos olvida como hicimos tal y cual... Saludos!</content><link rel='replies' type='application/atom+xml' href='http://arduinotesting.blogspot.com/feeds/7332990062402369716/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/presentacion-del-blog.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7332990062402369716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3817665187453699659/posts/default/7332990062402369716'/><link rel='alternate' type='text/html' href='http://arduinotesting.blogspot.com/2010/07/presentacion-del-blog.html' title='Presentación del blog'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>