        <style>
            #donation_buttons td{
                border:medium none;
                background: inherit !important;
            }
            #donation_buttons table{               
                border:medium none;
                margin: auto;
                width: auto;
            }
        </style>
        {"id":6413,"date":"2021-05-03T03:14:32","date_gmt":"2021-05-03T03:14:32","guid":{"rendered":"https:\/\/rogerbit.com\/wprb\/?p=6413"},"modified":"2021-05-03T03:14:32","modified_gmt":"2021-05-03T03:14:32","slug":"8-channel-dual-light-ignition-system-infrared-and-pushbuttons","status":"publish","type":"post","link":"https:\/\/rogerbit.com\/wprb\/2021\/05\/8-channel-dual-light-ignition-system-infrared-and-pushbuttons\/","title":{"rendered":"8-channel dual light ignition system, infrared and pushbuttons"},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"\ud83d\udca1 Sistema de encendido de luces dual de 8 canales, por infrarrojos y pulsadores - PCBWay.es\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/uvJIHicDhEo?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>In this tutorial we will put together a dual light ignition system, since we can control the ignition and paid by means of an infrared remote control, and also by means of 8 pushbuttons. We will use an 8-channel relay module, an arduino nano, an infrared receiver module, a pcb made of pcbway, and other electronic components. We will assemble the circuit, step by step analyze the source code and finally test all the operation of the system.<\/p>\n<hr \/>\n<p>You may be interested in projects in Arduino, pic, robotics, telecommunications,\u00a0<a href=\"http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\">subscribe http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1<\/a>\u00a0videos with full source code and diagrams<\/p>\n<div id=\"ubm-banners-rotation-n1\" data-interval=\"4000\" class=\"ubm_banners_rotation\" style=\"overflow: hidden; width: 200px; height: 150px;\"><div id=\"3_ubm_banner\" class=\"ubm_rotating_banner\"><a href=\"https:\/\/bit.ly\/3aXRDAu\" target=\"_blank\" rel=\"dofollow\"><img src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/useful_banner_manager_banners\/3-2-logo youtube.png\" width=\"100%\" height=\"100%\" alt=\"SUSCRIBETE A NUESTRO CANAL DE YOUTUBE, TUTORIALES GRATIS\" \/><\/a><\/div><\/div>\n<hr \/>\n<p>materials<\/p>\n<h4>An Arduino nano<\/h4>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano.jpg\"><img loading=\"lazy\" class=\"alignnone wp-image-6304\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano.jpg\" sizes=\"(max-width: 376px) 100vw, 376px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano.jpg 800w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano-150x150.jpg 150w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/arduino-nano-768x768.jpg 768w\" alt=\"\" width=\"376\" height=\"376\" \/><\/a><\/p>\n<p>The Arduino Nano is a small board, complete and compatible with the test board based on the ATmega328 (Arduino Nano 3.x). It has about the same functionality as the Arduino Duemilanove, but in a different package. It only lacks a DC power connector and works with a Mini-B USB cable instead of a standard one.<\/p>\n<table>\n<tbody>\n<tr>\n<td>microcontroller<\/td>\n<td>ATmega328<\/td>\n<\/tr>\n<tr>\n<td>architecture<\/td>\n<td>AVR<\/td>\n<\/tr>\n<tr>\n<td>Operating voltage<\/td>\n<td>5 V<\/td>\n<\/tr>\n<tr>\n<td>Flash memory<\/td>\n<td>32 KB of which 2 KB uses the bootloader<\/td>\n<\/tr>\n<tr>\n<td>Sram<\/td>\n<td>2 KB<\/td>\n<\/tr>\n<tr>\n<td>Clock speed<\/td>\n<td>16 MHz<\/td>\n<\/tr>\n<tr>\n<td>Analog pins IN<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>Eeprom<\/td>\n<td>1 KB<\/td>\n<\/tr>\n<tr>\n<td>DC current by I\/O pins<\/td>\n<td>40 mA (I\/O pins)<\/td>\n<\/tr>\n<tr>\n<td>Input voltage<\/td>\n<td>7-12 V<\/td>\n<\/tr>\n<tr>\n<td>Digital I\/O Pins<\/td>\n<td>22 (6 of which are PWM)<\/td>\n<\/tr>\n<tr>\n<td>PWM output<\/td>\n<td>6<\/td>\n<\/tr>\n<tr>\n<td>Energy consumption<\/td>\n<td>19 mA<\/td>\n<\/tr>\n<tr>\n<td>PCB size<\/td>\n<td>18 x 45 mm<\/td>\n<\/tr>\n<tr>\n<td>weight<\/td>\n<td>7g<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Pin diagram<\/h3>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO.png\"><img loading=\"lazy\" class=\"alignnone wp-image-6033 size-large\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-1024x1024.png\" sizes=\"(max-width: 1024px) 100vw, 1024px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-1024x1024.png 1024w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-150x150.png 150w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-300x300.png 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-768x768.png 768w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-600x600.png 600w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-820x820.png 820w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/11\/Pinout-NANO-1320x1321.png 1320w\" alt=\"\" width=\"1024\" height=\"1024\" \/><\/a><\/p>\n<hr \/>\n<h4>Female pins<\/h4>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/kit-pines-hembra-arduino.jpg\"><img loading=\"lazy\" class=\"alignnone wp-image-6305\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/kit-pines-hembra-arduino.jpg\" sizes=\"(max-width: 270px) 100vw, 270px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/kit-pines-hembra-arduino.jpg 600w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/kit-pines-hembra-arduino-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/kit-pines-hembra-arduino-150x150.jpg 150w\" alt=\"\" width=\"270\" height=\"270\" \/><\/a><\/p>\n<hr \/>\n<h4>A socket for the Arduino nano<\/h4>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/zocalo.png\"><img loading=\"lazy\" class=\"alignnone wp-image-6311\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/zocalo.png\" sizes=\"(max-width: 380px) 100vw, 380px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/zocalo.png 594w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/zocalo-300x205.png 300w\" alt=\"\" width=\"380\" height=\"260\" \/><\/a><\/p>\n<hr \/>\n<p>8-channel relay module<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-6404\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/8_canales_relay.jpg\" sizes=\"(max-width: 700px) 100vw, 700px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/8_canales_relay.jpg 700w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/8_canales_relay-300x178.jpg 300w\" alt=\"\" width=\"700\" height=\"416\" \/><\/p>\n<p><strong>characteristics<\/strong><\/p>\n<p>Controls the on\/off of high-powered equipment (appliances). Works perfectly with Arduino, Pic or any other digital system.<\/p>\n<p>Within the wide variety of projects that we can carry out with Arduino, we may want to control high voltage or high amperage components, such as bulbs or water pumps, which cannot be handled directly with Arduino. In these cases it is necessary to use Relays or Reles, these devices allow to control high voltage loads with a small signal.<\/p>\n<p>The module has 8 high quality relays, capable of handling loads up to 250V\/10A. Each channel has electrical insulation by means of an optocoupler and a status indicator LED. Its design makes it easy to work with Arduino, as with many other systems such as Raspberry Pi, ESP8266 (NodeMCU and Wemos), Teensy and Pic. This Relay module activates the normally open output (NO: Normally Open) when receiving a logical &#8220;0&#8221; (0 Volts) and deactivates the output with a logical &#8220;1&#8221; (5 volts). For Arduino and Relays programming it is recommended to use timers with the &#8220;millis()&#8221; function and therefore not use the &#8220;delay&#8221; function that prevents the system from continuing to work while a relay is on\/off.<\/p>\n<p>Among the loads that can be handled we have: light bulbs, luminaires, AC motors (220V), DC motors, solenoids, solenoid valves, water heaters and a wide variety of other actuators. It is recommended to perform and verify connections before powering the circuit, it is also a good practice to protect the circuit within a case.<\/p>\n<p><strong>Technical data<\/strong><\/p>\n<p>8 independent channels<\/p>\n<p>8 1-pole relays 2 shots<\/p>\n<p>Relay coil voltage is 5 VDC<\/p>\n<p>Led indicator for each channel (lights when relay coil is active)<\/p>\n<p>Current-activated: the control circuit must provide a current of 15 to 20 mA<\/p>\n<p>Can be directly controlled by logical circuits<\/p>\n<p>Screw connection terminals (clemas)<\/p>\n<p>Logical signal input terminals with 0.1&#8243; male headers.<\/p>\n<p>Can be directly controlled by logical circuits<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Food and consumption<\/strong><\/p>\n<p>The easiest way to power this module is from Vcc and GND of the Arduino board, keeping the Jumper in place, so JD-Vcc Vcc. This connection has two important limitations:<\/p>\n<p>The electrical switching provided by optocouplers is lost, increasing the chance of damage to the Arduino if there is a problem with relay loads.<\/p>\n<p>The current consumed by the relay coils must be provided by the Arduino board. Each coil consumes about 90 mA and the four joints add up to 360 mA. If we add to this the consumptions that other outputs can have, we are very close to the 500 mA that a USB port can supply. In this case the Arduino should be fed with an external source, which increases the current limit to 1 A (in the case of the Arduino UNO).<\/p>\n<p>The safest way is to remove the jumper and power the relay board with two sources: that of the Arduino board connected to Vcc and a second source, with the positive to JD-Vcc and the negative to GND, without being attached to the Arduino board. This connection has as advantages:<\/p>\n<p>There is complete ingessation between the load and the Arduino.<\/p>\n<p>All relay consumption is taken from the second source and not from the Arduino or USB port.<\/p>\n<p><strong>Tickets<\/strong><\/p>\n<p>The inputs to the board can be connected directly to the digital outputs of the Arduino board. The only precaution to keep in mind is that when Arduino starts when it is fed, the pins are configured as inputs automatically and it can happen that, due to a very short period of time between the start and the correct configuration of these pins as outputs, the control inputs to the relay module are in an undetermined state. This can be avoided by connecting a pull-up with a resistance of 10K to Vcc at each input, ensuring a HIGH state during boot.<\/p>\n<hr \/>\n<p>Male pins<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6405\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/conector-empalme-tira-led-4-pines-macho-macho-x4.jpg\" sizes=\"(max-width: 244px) 100vw, 244px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/conector-empalme-tira-led-4-pines-macho-macho-x4.jpg 458w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/conector-empalme-tira-led-4-pines-macho-macho-x4-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/conector-empalme-tira-led-4-pines-macho-macho-x4-150x150.jpg 150w\" alt=\"\" width=\"244\" height=\"244\" \/><\/p>\n<hr \/>\n<p>Ky-022 infrared receiver module<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6406\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/ky-022.jpg\" sizes=\"(max-width: 293px) 100vw, 293px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/ky-022.jpg 800w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/ky-022-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/ky-022-150x150.jpg 150w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/ky-022-768x768.jpg 768w\" alt=\"\" width=\"293\" height=\"293\" \/><\/p>\n<p>Size: 6.4 * 7.4 * 5.1MM, acceptance angle 90o, working voltage 2.7-5.5V.<br \/>\nFrequency 37.9KHZ, receiving the distance 18 m.<\/p>\n<p>Daylight rejection up to 500LUX, electromagnetic interference capability, built-in dedicated infrared IC.<br \/>\nWidely used: stereo, TV, VCR, CD, set-top boxes, digital photo frame, car audio, remote control toys, satellite receivers, hard drive, air conditioning, heating, fans, lighting and other appliances.<\/p>\n<p>Pinout:<\/p>\n<p>1 &#8230;. GND (-)<\/p>\n<p>2 &#8230;. + 5V<\/p>\n<p>3 &#8230;. Output (S)<\/p>\n<hr \/>\n<p>Eight pushbuttons<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6407\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pulsador.jpg\" sizes=\"(max-width: 188px) 100vw, 188px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pulsador.jpg 227w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pulsador-150x150.jpg 150w\" alt=\"\" width=\"188\" height=\"188\" \/><\/p>\n<hr \/>\n<p>A pcb<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-6408\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pcb.png\" sizes=\"(max-width: 351px) 100vw, 351px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pcb.png 351w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/pcb-258x300.png 258w\" alt=\"\" width=\"351\" height=\"408\" \/><\/p>\n<p>Download \u2013&gt;\u00a0<a href=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/05\/Gerber_PCB_control-de-luces-de-8-canales-por-infrarrojo.zip\">8-channel infrared light control<\/a><\/p>\n<hr \/>\n<p>source code<\/p>\n<pre class=\"lang:arduino decode:true \" title=\"Source code\">\/\/M\u00e1s proyectos en www.rogerbit.com\r\n#include &lt;IRremote.h&gt;\r\n#define RECV_PIN 2 \/\/indicamos el pin por el que recibimos los datos del \r\n\/\/sensor TSOP1838\r\nIRrecv irrecv(RECV_PIN);\r\ndecode_results results;\r\nint estadoBoton11 = 0;\r\nint estadoBoton12 = 0;\r\nint estadoBotonA5 = 0;\r\nint estadoBotonA0 = 0;\r\nint estadoBotonA1 = 0;\r\nint estadoBotonA2 = 0;\r\nint estadoBotonA3 = 0;\r\nint estadoBotonA4 = 0;\r\n\r\nint estado11 = 0;\r\nint estado12 = 0;\r\nint estadoA5 = 0;\r\nint estadoA0 = 0;\r\nint estadoA1 = 0;\r\nint estadoA2 = 0;\r\nint estadoA3 = 0;\r\nint estadoA4 = 0;\r\n\/\/Pulsadores\r\nint botonPin11 =11; \r\nint botonPin12 =12;\r\nint botonPinA5 =A5;\r\nint botonPinA0 =A0;\r\nint botonPinA1 =A1;\r\nint botonPinA2 =A2;\r\nint botonPinA3 =A3;\r\nint botonPinA4 =A4;\r\nvoid setup()\r\n{\r\n     Serial.begin(9600);\/\/Velocidad del puerto\r\n     \/\/Definimos estos pines como salidas\r\n     pinMode(3,OUTPUT);  \r\n     pinMode(4,OUTPUT);  \r\n     pinMode(5,OUTPUT); \r\n     pinMode(6,OUTPUT); \r\n     pinMode(7,OUTPUT); \r\n     pinMode(8,OUTPUT); \r\n     pinMode(9,OUTPUT); \r\n     pinMode(10,OUTPUT);\r\n     \/\/Ponemos en estado Alto todas las salidas \r\n     digitalWrite(3,HIGH);\r\n     digitalWrite(4,HIGH);\r\n     digitalWrite(5,HIGH);\r\n     digitalWrite(6,HIGH);\r\n     digitalWrite(7,HIGH);\r\n     digitalWrite(8,HIGH);\r\n     digitalWrite(9,HIGH);\r\n     digitalWrite(10,HIGH);\r\n     \/\/Definimos estos pines como entrdas para los pulsadores\r\n     pinMode(botonPin11, INPUT_PULLUP);\r\n     pinMode(botonPin12, INPUT_PULLUP);\r\n     pinMode(botonPinA5, INPUT_PULLUP);\r\n     pinMode(botonPinA0, INPUT_PULLUP);\r\n     pinMode(botonPinA1, INPUT_PULLUP);\r\n     pinMode(botonPinA2, INPUT_PULLUP);\r\n     pinMode(botonPinA3, INPUT_PULLUP);\r\n     pinMode(botonPinA4, INPUT_PULLUP);\r\n     irrecv.enableIRIn(); \/\/ Iniciamos la recepcion\r\n}\r\nvoid loop()\r\n{\r\n\/\/Si tenemos datos de lectura debido a que se pulsa una tecla en el mando\r\n   if (irrecv.decode(&amp;results))\r\n    {\r\n\/\/Mostramos por puerto serie dicho codigo en Hexadecimal(para depuracion)\r\n   Serial.print(\"Codigo: 0x\") ;\r\n   Serial.println(results.value,HEX) ;\r\n\/\/Pin 3 arduino IN1 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x2B||results.value==0x82B)\/\/Apagado\r\n   {\r\n digitalWrite(3,HIGH);\r\n estado11 = 0;\r\n        }\r\n        \r\nif(results.value==0x2A||results.value==0x82A)\/\/Encendido\r\n   {\r\n digitalWrite(3, LOW);\r\n estado11 = 1;\r\n        }   \r\n\/\/Pin 4 arduino IN2 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x23||results.value==0x823)\/\/Apagado\r\n   {\r\n digitalWrite(4,HIGH);\r\n estado12 = 0;\r\n        }\r\n        \r\nif(results.value==0x27||results.value==0x827)\/\/Encendido\r\n   {\r\n digitalWrite(4, LOW);\r\n estado12 = 1;\r\n        }\r\n\/\/Pin 5 arduino IN3 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0xB||results.value==0x80B)\/\/Apagado\r\n   {\r\n digitalWrite(5,HIGH);\r\n estadoA5 = 0;\r\n   }   \r\n\r\nif(results.value==0x3D||results.value==0x83D)\/\/Encendido\r\n   {\r\n digitalWrite(5,LOW);\r\n estadoA5 = 1;\r\n   }\r\n\/\/Pin 6 arduino IN4 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x30||results.value==0x830)\/\/Apagado\r\n   {\r\n digitalWrite(6,HIGH);\r\n  estadoA0 = 0;\r\n   }   \r\n\r\nif(results.value==0x2F||results.value==0x82F)\/\/Encendido\r\n   {\r\n digitalWrite(6,LOW);\r\n  estadoA0 = 1;\r\n   }\r\n\/\/Pin 7 arduino IN5 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x33||results.value==0x833)\/\/Apagado\r\n   {\r\n digitalWrite(7,HIGH);\r\n  estadoA1 = 0;\r\n   }   \r\n\r\nif(results.value==0x31||results.value==0x831)\/\/Encendido\r\n   {\r\n digitalWrite(7,LOW);\r\n   estadoA1 = 1;\r\n   }   \r\n\/\/Pin 8 arduino IN6 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x21||results.value==0x821)\/\/Apagado\r\n   {\r\n digitalWrite(8,HIGH);\r\n  estadoA2 = 0;\r\n   }   \r\n\r\nif(results.value==0x20||results.value==0x820)\/\/Encendido\r\n   {\r\n digitalWrite(8,LOW);\r\n  estadoA2 = 1;\r\n   } \r\n\/\/Pin 9 arduino IN7 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x24||results.value==0x824)\/\/Apagado\r\n   {\r\n digitalWrite(9,HIGH);\r\n  estadoA3 = 0;\r\n   }   \r\n\r\nif(results.value==0xE||results.value==0x80E)\/\/Encendido\r\n   {\r\n digitalWrite(9,LOW);\r\n  estadoA3 = 1;\r\n   } \r\n\/\/Pin 10 arduino IN8 en m\u00f3dulo relay de 8 canales\r\nif(results.value==0x11||results.value==0x811)\/\/Apagado\r\n   {\r\n digitalWrite(10,HIGH);\r\n  estadoA4 = 0;\r\n   }   \r\n\r\nif(results.value==0x10||results.value==0x810)\/\/Encendido\r\n   {\r\n digitalWrite(10,LOW);\r\n  estadoA4 = 1;\r\n   } \r\nirrecv.resume(); \/\/ Recibimos el siguiente valor del sensor\r\n}\r\ndelay(100);\/\/Retardo antirrebote para los pulsadores\r\nestadoBoton11 = digitalRead(botonPin11);\/\/Leemos el pulsador para ver su estado\r\nestadoBoton12 = digitalRead(botonPin12);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA5 = digitalRead(botonPinA5);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA0 = digitalRead(botonPinA0);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA1 = digitalRead(botonPinA1);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA2 = digitalRead(botonPinA2);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA3 = digitalRead(botonPinA3);\/\/Leemos el pulsador para ver su estado\r\nestadoBotonA4 = digitalRead(botonPinA4);\/\/Leemos el pulsador para ver su estado\r\n  \/\/Llama a una funci\u00f3n\r\nif (estadoBoton11 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luz11();\r\n }\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBoton12 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luz12();\r\n }\r\n\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA5 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA5();\r\n }\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA0 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA0();\r\n }\r\n\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA1 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA1();\r\n } \r\n\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA2 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA2();\r\n }\r\n\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA3 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA3();\r\n } \r\n\r\n \/\/Llama a una funci\u00f3n\r\nif (estadoBotonA4 == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\n  luzA4();\r\n } \r\n \r\n}\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luz11(){\r\nif(estado11 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(3, LOW);\/\/ Encendemos el relay\r\nestado11 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(3, HIGH);\/\/Apagamos el relay\r\n estado11 = 0;\r\n  }\r\nwhile(estadoBoton11 == LOW){\r\nestadoBoton11 = digitalRead(11);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luz12(){\r\nif(estado12 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(4, LOW);\/\/ Encendemos el relay\r\nestado12 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(4, HIGH);\/\/Apagamos el relay\r\n estado12 = 0;\r\n  }\r\nwhile(estadoBoton12 == LOW){\r\nestadoBoton12 = digitalRead(12);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luzA5(){\r\nif(estadoA5 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(5, LOW);\/\/ Encendemos el relay\r\nestadoA5 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(5, HIGH);\/\/Apagamos el relay\r\n estadoA5 = 0;\r\n  }\r\nwhile(estadoBotonA5 == LOW){\r\nestadoBotonA5 = digitalRead(A5);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\nvoid luzA0(){\r\nif(estadoA0 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(6, LOW);\/\/ Encendemos el relay\r\nestadoA0 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(6, HIGH);\/\/Apagamos el relay\r\n estadoA0 = 0;\r\n  }\r\nwhile(estadoBotonA0 == LOW){\r\nestadoBotonA0 = digitalRead(A0);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luzA1(){\r\nif(estadoA1 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(7, LOW);\/\/ Encendemos el relay\r\nestadoA1 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(7, HIGH);\/\/Apagamos el relay\r\n estadoA1 = 0;\r\n  }\r\nwhile(estadoBotonA1 == LOW){\r\nestadoBotonA1 = digitalRead(A1);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }  \r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luzA2(){\r\nif(estadoA2 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(8, LOW);\/\/ Encendemos el relay\r\nestadoA2 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(8, HIGH);\/\/Apagamos el relay\r\n estadoA2 = 0;\r\n  }\r\nwhile(estadoBotonA2 == LOW){\r\nestadoBotonA2 = digitalRead(A2);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luzA3(){\r\nif(estadoA3 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(9, LOW);\/\/ Encendemos el relay\r\nestadoA3 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(9, HIGH);\/\/Apagamos el relay\r\n estadoA3 = 0;\r\n  }\r\nwhile(estadoBotonA3 == LOW){\r\nestadoBotonA3 = digitalRead(A3);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }\r\n\r\n\/\/Funci\u00f3n para encender la luz con el bot\u00f3n\r\nvoid luzA4(){\r\nif(estadoA4 ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(10, LOW);\/\/ Encendemos el relay\r\nestadoA4 = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\n} else{\r\n digitalWrite(10, HIGH);\/\/Apagamos el relay\r\n estadoA4 = 0;\r\n  }\r\nwhile(estadoBotonA4 == LOW){\r\nestadoBotonA4 = digitalRead(A4);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }  \r\n  }<\/pre>\n<hr \/>\n<div class=\"page-sidebar widget\" id=\"donation_buttons\"><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_blank\" ><input type=\"hidden\" name=\"business\" value=\"donacion@rogerbit.com\"><input type=\"hidden\" name=\"bn\" value=\"mbjtechnolabs_SP\"><input type=\"hidden\" name=\"cmd\" value=\"_donations\"><input type=\"hidden\" name=\"item_name\" value=\"Ayuda a RogerBit.com\"><input type=\"hidden\" name=\"item_number\" value=\"www.rogerbit.com\"><input type=\"hidden\" class=\"set_donation_button_amount\" name=\"amount\" value=\"1\"><table ><tbody><tr><td><label for=\"rogerBit necesita de tu ayuda para seguir existiendo :-)\">rogerBit necesita de tu ayuda para seguir existiendo :-)<\/label><\/td><\/tr><\/tbody><\/table><table ><tbody><tr><td><input style=\"margin-top:10px;\" type=\"image\" name=\"submit\" border=\"0\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" alt=\"PayPal - The safer, easier way to pay online\"><\/td><\/tr><\/tbody><\/table><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"hidden\" name=\"notify_url\" value=\"https:\/\/rogerbit.com\/wprb\/?Donation_Button&#038;action=ipn_handler\"><\/form><\/div>\n<hr \/>\n<p><strong>RECOMMENDED PROJECT<\/strong><\/p>\n<p><iframe loading=\"lazy\" title=\"\ud83c\udfe1 Dom\u00f3tica: Encendendiendo luces con control remoto infrarrojo - Muy f\u00e1cil\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/uksrYiXYthE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In this tutorial we will put together a dual light ignition system, since we can control the ignition and paid by means of an infrared remote control, and also by means of 8 pushbuttons. We will use an 8-channel relay module, an arduino nano, an infrared receiver module, a pcb made of pcbway, and other [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":6402,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[648],"tags":[1179,45,767,1177,181,1100,950,595,1071,1069,966,1008,514,1176,1178,1174,613,1068,1066,917,1175,1180,986,687,1137],"_links":{"self":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6413"}],"collection":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/comments?post=6413"}],"version-history":[{"count":1,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6413\/revisions"}],"predecessor-version":[{"id":6414,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6413\/revisions\/6414"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media\/6402"}],"wp:attachment":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media?parent=6413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/categories?post=6413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/tags?post=6413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}