        <style>
            #donation_buttons td{
                border:medium none;
                background: inherit !important;
            }
            #donation_buttons table{               
                border:medium none;
                margin: auto;
                width: auto;
            }
        </style>
        {"id":6811,"date":"2022-04-23T00:24:57","date_gmt":"2022-04-23T00:24:57","guid":{"rendered":"https:\/\/rogerbit.com\/wprb\/?p=6811"},"modified":"2022-04-23T01:52:53","modified_gmt":"2022-04-23T01:52:53","slug":"encendido-apagado-aire","status":"publish","type":"post","link":"https:\/\/rogerbit.com\/wprb\/2022\/04\/encendido-apagado-aire\/","title":{"rendered":"Control de encendido apagado de aire acondicionado x telegram y esp32"},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"\u2705 Control de encendido apagado de aire acondicionado x telegram y esp32 - PCBWay.es\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/WnF_LhFDV2U?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<hr \/>\n<p>En este tutorial veremos como controlar un aire acondicionado, con un esp32 y la aplicaci\u00f3n telegram, desde cualquier parte del mundo, donde tengamos acceso a internet. El dispositivo, puede capturar con un m\u00f3dulo receptor infrarrojo, los comandos de un aire acondicionado, y en este proyecto controlaremos el encendido y apagado con la aplicaci\u00f3n telegram, pero adem\u00e1s podremos monitorear, el cambio de temperatura, para ver si realmente se ha encendido.<\/p>\n<hr \/>\n<p style=\"text-align: left;\">Tal vez pueda interesarte proyectos en arduino, pic, rob\u00f3tica, telecomunicaciones, suscribete en\u00a0<a href=\"http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\">http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1<\/a>\u00a0mucho videos con c\u00f3digo fuentes completos y diagramas<\/p>\n<p style=\"text-align: left;\"><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><\/p>\n<hr \/>\n<h4>Componentes electr\u00f3nicos<\/h4>\n<h4>Un Esp32<\/h4>\n<p><a href=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/esp32.jpg\"><img loading=\"lazy\" class=\"alignnone wp-image-6331\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/esp32.jpg\" sizes=\"(max-width: 407px) 100vw, 407px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/esp32.jpg 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/esp32-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/esp32-150x150.jpg 150w\" alt=\"\" width=\"407\" height=\"407\" \/><\/a><\/p>\n<h4>Caracter\u00edsticas del m\u00f3dulo ESP32-T<\/h4>\n<p><img src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2017\/08\/esp32pinout-227x300.jpg\" \/><\/p>\n<h3>Conectividad<\/h3>\n<hr \/>\n<p>El m\u00f3dulo ESP32 dispone de todas las variantes del\u00a0<strong>WiFi<\/strong>:<\/p>\n<ul>\n<li>802.11 b\/g\/n\/e\/i\/n<\/li>\n<li>Wi-Fi Direct (P2P), P2P Discovery, P2P Group Owner mode and P2P Power Management<\/li>\n<\/ul>\n<p>Esta versi\u00f3n nueva incluye la conectividad mediante<strong>\u00a0Bluethoot<\/strong>\u00a0de bajo consumo<\/p>\n<ul>\n<li>Bluetooth v4.2 BR\/EDR and BLE<\/li>\n<li>BLE Beacon<\/li>\n<\/ul>\n<p>Adem\u00e1s, puede comunicarse mediante los protocoles<strong>\u00a0SPI, I2C, UART, MAC Ethernet, Host SD<\/strong><\/p>\n<h3>Prestaciones\u00a0del microcontrolador<\/h3>\n<hr \/>\n<p>La\u00a0<strong>CPU<\/strong>\u00a0est\u00e1 formado por un\u00a0<strong>SoC modelo Tensilica LX6<\/strong>\u00a0con las siguientes caracter\u00edsticas\u00a0y memoria<\/p>\n<ul>\n<li>Doble n\u00facleo de 32 bits con velocidad de 160MHz<\/li>\n<li>Memoria ROM de 448 kBytes<\/li>\n<li>Memoria SRAM de 520kBytes<\/li>\n<\/ul>\n<p>Dispne de<strong>\u00a048 Pines<\/strong><\/p>\n<ul>\n<li>18 ADC de 12 bits<\/li>\n<li>2 DAC de 8 bits<\/li>\n<li>10 pines sensores de contacto<\/li>\n<li>16 PWM<\/li>\n<li>20 Entradas\/salidas digitales<\/li>\n<\/ul>\n<h3>Alimentaci\u00f3n y modos de consumo<\/h3>\n<p>Para un correcto funcionamiento del ESP32 es necesario subministrar un voltaje de entre 2,8V y 3,6V. La energ\u00eda que consume depende del modo de funcionamiento. Contiene un modo, el\u00a0<strong>Ultra Low Power Solution (ULP)<\/strong>, en que se contin\u00faan realizando tareas b\u00e1sicas (ADC, RTC\u2026) en el modo Sleep.<\/p>\n<hr \/>\n<p><strong>Pines hembra<\/strong><\/p>\n<p><a href=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/pines-hembra.jpg\"><img loading=\"lazy\" class=\"alignnone wp-image-6332\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/pines-hembra.jpg\" sizes=\"(max-width: 500px) 100vw, 500px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/pines-hembra.jpg 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/03\/pines-hembra-300x223.jpg 300w\" alt=\"\" width=\"378\" height=\"281\" \/><\/a><\/p>\n<hr \/>\n<p><strong>M\u00f3dulo receptor infrarrojo ky-022<\/strong><\/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>Tama\u00f1o: 6.4 * 7.4 * 5.1MM, \u00e1ngulo de aceptaci\u00f3n 90 \u00b0, voltaje de trabajo 2.7-5.5V.<br \/>\nFrecuencia 37.9KHZ, recibiendo la distancia 18 m.<\/p>\n<p>Rechazo de luz diurna hasta 500LUX, capacidad de interferencia electromagn\u00e9tica, IC dedicado de infrarrojos incorporado.<br \/>\nAmpliamente utilizado: est\u00e9reo, TV, VCR, CD, decodificadores, marco de fotos digital, audio para el autom\u00f3vil, juguetes de control remoto, receptores de sat\u00e9lite, disco duro, aire acondicionado, calefacci\u00f3n, ventiladores, iluminaci\u00f3n y otros electrodom\u00e9sticos.<\/p>\n<p>Pinout:<\/p>\n<p>1 \u2026. GND (-)<\/p>\n<p>2 \u2026. + 5V<\/p>\n<p>3 \u2026. Salida (S)<\/p>\n<hr \/>\n<p><strong>Un transistor 2n3904<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6779\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2n3904.png\" sizes=\"(max-width: 262px) 100vw, 262px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2n3904.png 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2n3904-300x300.png 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2n3904-150x150.png 150w\" alt=\"\" width=\"262\" height=\"262\" \/><\/p>\n<table class=\"MuiTable-root jss289\">\n<tbody class=\"MuiTableBody-root\">\n<tr class=\"MuiTableRow-root jss298\">\n<td class=\"MuiTableCell-root jss292 MuiTableCell-body\">\n<div class=\"jss293\">Descripci\u00f3n<\/div>\n<\/td>\n<td class=\"MuiTableCell-root MuiTableCell-body jss291\">\n<div class=\"jss293\">SMALL SIGNAL BIPOLAR TRANSISTOR<\/div>\n<\/td>\n<td class=\"MuiTableCell-root MuiTableCell-body jss294\">\n<div class=\"copy-to-clipboard jss287 jss293\"><\/div>\n<\/td>\n<\/tr>\n<tr class=\"MuiTableRow-root jss298\" data-testid=\"detailed-description\">\n<td class=\"MuiTableCell-root jss292 MuiTableCell-body\">\n<div id=\"detailedDescription\" class=\"jss293\">Descripci\u00f3n detallada<\/div>\n<\/td>\n<td class=\"MuiTableCell-root MuiTableCell-body jss291\">\n<div class=\"jss293\">Transistores \u2013 Bipolar (BJT) \u2013 Simple NPN 40 V 200 mA 300MHz 625 mW Orificio pasante TO-92-3<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Hoja de datos<\/strong><\/p>\n<p><a href=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/ONSMS24978-1.pdf\">2n3904<\/a><\/p>\n<p><strong>Pinout<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6781\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2N3904.jpg\" sizes=\"(max-width: 259px) 100vw, 259px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2N3904.jpg 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2N3904-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/03\/2N3904-150x150.jpg 150w\" alt=\"\" width=\"259\" height=\"259\" \/><\/p>\n<hr \/>\n<p><strong>Un resistor de 100 Ohm<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6814\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/100.jpg\" alt=\"\" width=\"255\" height=\"134\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/100.jpg 600w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/100-300x158.jpg 300w\" sizes=\"(max-width: 255px) 100vw, 255px\" \/><\/p>\n<hr \/>\n<p><strong>Un resistor de 470 Ohm<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6815\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/470.jpg\" alt=\"\" width=\"177\" height=\"177\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/470.jpg 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/470-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/470-150x150.jpg 150w\" sizes=\"(max-width: 177px) 100vw, 177px\" \/><\/p>\n<hr \/>\n<div>\n<p><strong>Un Sensor de temperatura y humedad DHT11<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6520\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/06\/DHT11.jpg\" sizes=\"(max-width: 335px) 100vw, 335px\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/06\/DHT11.jpg 500w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/06\/DHT11-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2021\/06\/DHT11-150x150.jpg 150w\" alt=\"\" width=\"335\" height=\"335\" \/><\/p>\n<p>Este m\u00f3dulo consta de un sensor digital de humedad y temperatura DHT11 y una resistencia de 1 k\u03a9.\u00a0El DHT11 utiliza un termistor interno y un sensor de humedad capacitivo para determinar las condiciones ambientales, un chip interno es responsable de convertir las lecturas a una se\u00f1al digital en serie.<\/p>\n<table>\n<tbody>\n<tr>\n<td>Tensi\u00f3n de funcionamiento<\/td>\n<td>3.3V a 5.5V<\/td>\n<\/tr>\n<tr>\n<td>Rango de medici\u00f3n de humedad<\/td>\n<td>20% a 90% HR<\/td>\n<\/tr>\n<tr>\n<td>Precisi\u00f3n de medici\u00f3n de humedad<\/td>\n<td>\u00b1 5% HR<\/td>\n<\/tr>\n<tr>\n<td>Resoluci\u00f3n de medici\u00f3n de humedad<\/td>\n<td>1% HR<\/td>\n<\/tr>\n<tr>\n<td>Rango de medici\u00f3n de temperatura<\/td>\n<td>0\u00baC a 50\u00baC [32\u00baF a 122\u00baF]<\/td>\n<\/tr>\n<tr>\n<td>Precisi\u00f3n de medici\u00f3n de temperatura<\/td>\n<td>\u00b1 2\u00baC<\/td>\n<\/tr>\n<tr>\n<td>Resoluci\u00f3n de medici\u00f3n de temperatura<\/td>\n<td>1\u00baC<\/td>\n<\/tr>\n<tr>\n<td>Rango de transmisi\u00f3n de se\u00f1al<\/td>\n<td>20m<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<hr \/>\n<p><strong>Cables Dupont<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6816\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/dupont.jpg\" alt=\"\" width=\"256\" height=\"256\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/dupont.jpg 458w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/dupont-300x300.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/dupont-150x150.jpg 150w\" sizes=\"(max-width: 256px) 100vw, 256px\" \/><\/p>\n<hr \/>\n<p><strong>Un emisor infrarrojo<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6817\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/emisor_ir.jpg\" alt=\"\" width=\"309\" height=\"232\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/emisor_ir.jpg 350w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/emisor_ir-300x225.jpg 300w\" sizes=\"(max-width: 309px) 100vw, 309px\" \/><\/p>\n<hr \/>\n<p><strong>Un PCB<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6818\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-1024x622.png\" alt=\"\" width=\"596\" height=\"362\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-1024x622.png 1024w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-300x182.png 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-768x467.png 768w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-1536x933.png 1536w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-2048x1245.png 2048w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_b-820x498.png 820w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-6819\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-1024x628.png\" alt=\"\" width=\"595\" height=\"365\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-1024x628.png 1024w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-300x184.png 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-768x471.png 768w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-1536x942.png 1536w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-2048x1256.png 2048w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/pcb_n-820x503.png 820w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/p>\n<p>Archivo gerber &#8212;&gt; <a href=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/Gerber_Control-aire-acondicionado-por-telegram.zip\">Gerber_Control aire acondicionado por telegram<\/a><\/p>\n<hr \/>\n<p>Circuito<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-large wp-image-6820\" src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-1024x787.jpg\" alt=\"\" width=\"1024\" height=\"787\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-1024x787.jpg 1024w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-300x230.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-768x590.jpg 768w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-1536x1180.jpg 1536w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-2048x1573.jpg 2048w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2022\/04\/circuito-820x630.jpg 820w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<hr \/>\n<p><strong>C\u00f3digo fuente emisor<\/strong><\/p>\n<pre class=\"lang:default decode:true\" title=\"C\u00f3digo Fuente\">#include &lt;WiFi.h&gt;\r\n#include &lt;WiFiClientSecure.h&gt;\r\n#include &lt;UniversalTelegramBot.h&gt;\r\n#include \"PinDefinitionsAndMore.h\"\/\/Configuraci\u00f3n y definici\u00f3n de pines\r\n#include &lt;IRremote.hpp&gt;\r\n#include \"DHT.h\"\r\n\/\/ Reemplazar con los datos de tu red wifi\r\n#define WIFI_SSID \"Tu_red_wifi\"\r\n#define WIFI_PASSWORD \"tu_clave_wifi\"\r\n\/\/Token de Telegram BOT se obtenienen desde Botfather en telegram\r\n#define BOT_TOKEN \"tu_token_de_telegram\"\r\nconst unsigned long tiempo = 1000; \/\/tiempo medio entre mensajes de escaneo\r\nWiFiClientSecure secured_client;\r\nUniversalTelegramBot bot(BOT_TOKEN, secured_client);\r\nunsigned long tiempoAnterior; \/\/\u00faltima vez que se realiz\u00f3 el an\u00e1lisis de mensajes\r\nint inicio = 1;\r\nString datos;\r\nString stringT;\r\nString stringH;\r\nint aireEstado = 0;\r\n\/\/ Descomenta la linea dependiendo del sensor que vas a usar\r\n#define DHTTYPE DHT11 \/\/ DHT 11\r\n\/\/#define DHTTYPE DHT21 \/\/ DHT 21 \r\n\/\/#define DHTTYPE DHT22 \/\/ DHT 22\r\n#define DHTPin 23 \/\/Pin del sensor DHT;\r\nDHT dht(DHTPin, DHTTYPE); \r\nfloat t;\r\nfloat h;\r\nString chat_id;\r\n#define ID_Chat \"id_chat_telegram\"\/\/ID_Chat se obtiene de telegram\r\nvoid mensajesNuevos(int numerosMensajes)\r\n{\r\n  for (int i = 0; i &lt; numerosMensajes; i++)\r\n  {\r\n    String chat_id = bot.messages[i].chat_id;\r\n    String text = bot.messages[i].text;\r\n    if (text == \"\/TyH\")\r\n    {\r\nh = dht.readHumidity();\/\/Lectura de la humedad\r\nt = dht.readTemperature();\/\/Lectura de la temperatura\r\nstringT = String(t);\r\nstringH = String(h);\r\nSerial.print(\"T:\" );\r\nSerial.println(t);\r\nSerial.print(\"H:\" );\r\nSerial.println(h);\r\ndatos = \"Temperatura: \"+ stringT + \" Humedad: \" +stringH;\r\nbot.sendMessage(chat_id, datos, \"\");\/\/Enviamos la temperatura y humedad\r\n    }\r\n\/\/\/\/\/\/\/\/\/\/Comando para encender el aire acondicionado\/\/\/\/\/\/\r\n    if (text == \"\/Aireon\")\r\n    {\r\nconst uint16_t irSignal[227] = {\r\n\/\/C\u00f3digo para encendido de aire acondicionado marca Electra\r\n       3100, 1600     , 500, 1100     , 450, 1100     , 450,  300\r\n     , 500,  350     , 450,  350     , 450, 1100     , 450,  350\r\n     , 450,  350     , 450, 1150     , 400, 1150     , 400,  400\r\n     , 400, 1150     , 450,  350     , 450,  350     , 450, 1100\r\n     , 450, 1150     , 400,  400     , 400, 1150     , 400, 1150\r\n     , 400,  400     , 400,  400     , 400, 1150     , 450,  350\r\n     , 450,  350     , 450, 1100     , 450,  350     , 450,  350\r\n     , 450,  350     , 450,  350     , 450,  350     , 450,  350\r\n     , 450,  350     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400, 1150\r\n     , 400,  400     , 400,  400     , 400, 1150     , 450,  350\r\n     , 450,  350     , 400,  400     , 400, 1150     , 450,  350\r\n     , 450,  350     , 450,  350     , 450,  350     , 450,  350\r\n     , 450,  350     , 450,  350     , 400,  400     , 400,  400\r\n     , 400, 1150     , 450,  350     , 450,  350     , 450,  350\r\n     , 450,  350     , 450,  350     , 450,  350     , 450,  350\r\n     , 400,  400     , 400,  400     , 400,  400     , 400, 1150\r\n     , 400,  400     , 450,  350     , 450,  350     , 450,  350\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 350,  450     , 400,  400\r\n     , 350,  450     , 400,  400     , 400,  400     , 400,  400\r\n     , 350,  450     , 350,  450     , 350,  450     , 350,  450\r\n     , 350, 1200     , 400, 1150     , 400, 1150     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400\r\n\r\n};\r\nIrSender.sendRaw(irSignal, 227, 38);\r\nbot.sendMessage(chat_id, \"Comando encendido ejecutado\", \"\");\r\naireEstado = 1;\r\n    }\r\n\/\/\/\/\/\/\/\/\/\/Comando para apagar el aire acondicionado\/\/\/\/\/\/\/\/\r\n    if (text == \"\/Aireoff\")\r\n    {\r\nconst uint16_t irSignal2[227] = {\r\n\/\/C\u00f3digo para apagado de aire acondicionado marca Electra\r\n3100, 1600     , 450, 1100     , 500, 1100     , 450,  350\r\n     , 450,  350     , 450,  350     , 450, 1100     , 450,  400\r\n     , 400,  350     , 450, 1150     , 400, 1150     , 400,  400\r\n     , 400, 1150     , 400,  400     , 400,  400     , 400, 1150\r\n     , 400, 1150     , 400,  400     , 450, 1150     , 400, 1150\r\n     , 400,  400     , 400,  400     , 400, 1150     , 400,  400\r\n     , 400,  400     , 400, 1150     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  350     , 400, 1200     , 400,  400\r\n     , 400,  400     , 400, 1150     , 400, 1150     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400, 1150     , 400,  450     , 350,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400, 1150\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 350,  450     , 350,  450     , 350,  450\r\n     , 350,  450     , 350,  450     , 350,  450     , 350,  450\r\n     , 350,  450     , 350,  450     , 350,  450     , 350,  450\r\n     , 350,  450     , 350,  450     , 350,  450     , 350,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 400,  400\r\n     , 400, 1150     , 400,  400     , 400,  400     , 400,  400\r\n     , 400,  400     , 400,  400     , 400,  400     , 350,  500\r\n     , 300,  450     , 400\r\n\r\n};\r\nIrSender.sendRaw(irSignal2, 227, 38);\r\nbot.sendMessage(chat_id, \"Comando apagado ejecutado\", \"\");\r\naireEstado = 2;\r\n    }\r\n\/\/\/\/\/\/\/\/\u00daltimo comando enviado \/\/\/\/\/\/\/     \r\n\r\n    if (text == \"\/Estado\")\r\n    {\r\n      \/\/\/\/Ultimo comando enviado\/\/\/\/\r\n      if (aireEstado == 0)\r\n      {\r\n        bot.sendMessage(chat_id, \"No definido\", \"\");\r\n      }\r\n      if (aireEstado == 1)\r\n      {\r\n        bot.sendMessage(chat_id, \"\u00daltimo comando: Encendido\", \"\");\r\n      }\r\n      if (aireEstado == 2)\r\n      {\r\n        bot.sendMessage(chat_id, \"\u00daltimo comando: Apagado\", \"\");\r\n      }\r\n    }\r\n\r\n    if (text == \"\/Ayuda\")\r\n    {\r\n      String ayuda = \"Bienvenido al sistema de control luces con Esp32, \" \".\\n\";\r\n      ayuda += \"Estas son tus opciones.\\n\\n\";\r\n      ayuda += \"\/Aireon: para encender el aire \\n\";\r\n      ayuda += \"\/Aireoff: para apagar el aire \\n\";\r\n      ayuda += \"\/TyH : Muestra la Temperatura y Humedad \\n\";\r\n      ayuda += \"\/Ayuda: Imprime este men\u00fa \\n\";\r\n      ayuda += \"Recuerda el sistema distingue entre mayuculas y minusculas \\n\";\r\n      bot.sendMessage(chat_id, ayuda, \"\");\r\n    }\r\n    \r\n  }\r\n}\r\n\r\nvoid setup()\r\n{\r\n  Serial.begin(115200);\r\n  dht.begin();\/\/Inicializar el sensor DHT\r\n  \/\/ Intenta conectarse a la red wifi\r\n  Serial.print(\"Conectando a la red \");\r\n  Serial.print(WIFI_SSID);\r\n  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);\r\n  secured_client.setCACert(TELEGRAM_CERTIFICATE_ROOT); \/\/Agregar certificado ra\u00edz para api.telegram.org\r\n  while (WiFi.status() != WL_CONNECTED)\r\n  {\r\n    Serial.print(\".\");\r\n    delay(500);\r\n  }\r\n  Serial.print(\"\\nConectado a la red wifi. Direcci\u00f3n IP: \");\r\n  Serial.println(WiFi.localIP());\r\n   if(inicio == 1){\r\n    Serial.println(\"Sistema preparado\");\r\n    bot.sendMessage(ID_Chat, \"Sistema preparado!!!, escribe \/Ayuda para ver las opciones\", \"\");\/\/Enviamos un mensaje a telegram para informar que el sistema est\u00e1 listo\r\n    inicio = 0;\r\n    }\r\n}\r\n\r\nvoid loop()\r\n{\r\n  \/\/Verifica si hay datos nuevos en telegram cada 1 segundo\r\n  if (millis() - tiempoAnterior &gt; tiempo)\r\n  {\r\n    int numerosMensajes = bot.getUpdates(bot.last_message_received + 1);\r\n\r\n    while (numerosMensajes)\r\n    {\r\n      Serial.println(\"Comando recibido\");\r\n      mensajesNuevos(numerosMensajes);\r\n      numerosMensajes = bot.getUpdates(bot.last_message_received + 1);\r\n    }\r\n\r\n    tiempoAnterior = millis();\r\n  }\r\n  \r\n}<\/pre>\n<hr \/>\n<p>Definici\u00f3n de pines<\/p>\n<pre class=\"lang:default decode:true \" title=\"C\u00f3digo Fuente\">\/*\r\n *  PinDefinitionsAndMore.h\r\n *\r\n *  Contains pin definitions for IRremote examples for various platforms\r\n *  as well as definitions for feedback LED and tone() and includes\r\n *\r\n *  Copyright (C) 2021-2022  Armin Joachimsmeyer\r\n *  armin.joachimsmeyer@gmail.com\r\n *\r\n *  This file is part of IRremote https:\/\/github.com\/Arduino-IRremote\/Arduino-IRremote.\r\n *\r\n *  Arduino-IRremote is free software: you can redistribute it and\/or modify\r\n *  it under the terms of the GNU General Public License as published by\r\n *  the Free Software Foundation, either version 3 of the License, or\r\n *  (at your option) any later version.\r\n *\r\n *  This program is distributed in the hope that it will be useful,\r\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n *  GNU General Public License for more details.\r\n *\r\n *  You should have received a copy of the GNU General Public License\r\n *  along with this program.  If not, see &lt;http:\/\/www.gnu.org\/licenses\/gpl.html&gt;.\r\n *\r\n *\/\r\n\r\n\/*\r\n * Pin mapping table for different platforms\r\n *\r\n * Platform     IR input    IR output   Tone      Core\/Pin schema\r\n * --------------------------------------------------------------\r\n * DEFAULT\/AVR  2           3           4\r\n * ATtinyX5     0|PB0       4|PB4       3|PB3\r\n * ATtiny167    3|PA3       2|PA2       7|PA7     ATTinyCore\r\n * ATtiny167    9|PA3       8|PA2       5|PA7     Digispark pro\r\n * ATtiny3217  18|PA1      19|PA2      20|PA3     MegaTinyCore\r\n * ATtiny1604   2           3|PA5       %\r\n * SAMD21       3           4           5\r\n * ESP8266      14|D5       12|D6       %\r\n * ESP32        15          4           27\r\n * BluePill     PA6         PA7         PA3\r\n * APOLLO3      11          12          5\r\n * RP2040       3|GPIO15    4|GPIO16    5|GPIO17\r\n *\/\r\n\/\/#define _IR_MEASURE_TIMING \/\/ For debugging purposes.\r\n\r\n\/*\r\n * We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation\r\n *\/\r\n#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)\r\n#define SEND_PWM_BY_TIMER\r\n#endif\r\n\r\n#if defined(ESP8266)\r\n#define FEEDBACK_LED_IS_ACTIVE_LOW \/\/ The LED on my board (D4) is active LOW\r\n#define IR_RECEIVE_PIN          14 \/\/ D5\r\n#define IR_RECEIVE_PIN_STRING   \"D5\"\r\n#define IR_SEND_PIN             12 \/\/ D6 - D4\/pin 2 is internal LED\r\n#define IR_SEND_PIN_STRING      \"D6\"\r\n#define _IR_TIMING_TEST_PIN     13 \/\/ D7\r\n#define APPLICATION_PIN          0 \/\/ D3\r\n\r\n#define tone(...) void()      \/\/ tone() inhibits receive timer\r\n#define noTone(a) void()\r\n#define TONE_PIN                42 \/\/ Dummy for examples using it\r\n\r\n#elif defined(ESP32)\r\n#include &lt;Arduino.h&gt;\r\n\r\n#define TONE_LEDC_CHANNEL        1  \/\/ Using channel 1 makes tone() independent of receiving timer -&gt; No need to stop receiving timer.\r\nvoid tone(uint8_t _pin, unsigned int frequency){\r\n    ledcAttachPin(_pin, TONE_LEDC_CHANNEL);\r\n    ledcWriteTone(TONE_LEDC_CHANNEL, frequency);\r\n}\r\nvoid tone(uint8_t _pin, unsigned int frequency, unsigned long duration){\r\n    ledcAttachPin(_pin, TONE_LEDC_CHANNEL);\r\n    ledcWriteTone(TONE_LEDC_CHANNEL, frequency);\r\n    delay(duration);\r\n    ledcWriteTone(TONE_LEDC_CHANNEL, 0);\r\n}\r\nvoid noTone(uint8_t _pin){\r\n    ledcWriteTone(TONE_LEDC_CHANNEL, 0);\r\n}\r\n#define IR_RECEIVE_PIN          15  \/\/ D15\r\n#define IR_SEND_PIN             4  \/\/ D4\r\n#define TONE_PIN                27  \/\/ D27 25 &amp; 26 are DAC0 and 1\r\n#define APPLICATION_PIN         16  \/\/ RX2 pin\r\n\r\n#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) \/\/ BluePill\r\n\/\/ Timer 3 blocks PA6, PA7, PB0, PB1 for use by Servo or tone()\r\n#define IR_RECEIVE_PIN          PA6\r\n#define IR_RECEIVE_PIN_STRING   \"PA6\"\r\n#define IR_SEND_PIN             PA7\r\n#define IR_SEND_PIN_STRING      \"PA7\"\r\n#define TONE_PIN                PA3\r\n#define _IR_TIMING_TEST_PIN      PA5\r\n#define APPLICATION_PIN         PA2\r\n\r\n#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) \/\/ Digispark board\r\n#include \"ATtinySerialOut.hpp\" \/\/ Available as Arduino library \"ATtinySerialOut\". saves 370 bytes program space and 38 bytes RAM for digistump core\r\n#define IR_RECEIVE_PIN  0\r\n#define IR_SEND_PIN     4 \/\/ Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board.\r\n#define TONE_PIN        3\r\n#define _IR_TIMING_TEST_PIN 3\r\n\r\n#elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__) \/\/ Digispark pro board\r\n#include \"ATtinySerialOut.hpp\" \/\/ Available as Arduino library \"ATtinySerialOut\"\r\n\/\/ For ATtiny167 Pins PB6 and PA3 are usable as interrupt source.\r\n#  if defined(ARDUINO_AVR_DIGISPARKPRO)\r\n#define IR_RECEIVE_PIN   9 \/\/ PA3 - on Digispark board labeled as pin 9\r\n\/\/#define IR_RECEIVE_PIN  14 \/\/ PB6 \/ INT0 is connected to USB+ on DigisparkPro boards\r\n#define IR_SEND_PIN      8 \/\/ PA2 - on Digispark board labeled as pin 8\r\n#define TONE_PIN         5 \/\/ PA7\r\n#define _IR_TIMING_TEST_PIN 10 \/\/ PA4\r\n#  else\r\n#define IR_RECEIVE_PIN  3\r\n#define IR_SEND_PIN     2\r\n#define TONE_PIN        7\r\n#  endif\r\n\r\n#elif defined(__AVR_ATtiny88__) \/\/ MH-ET Tiny88 board\r\n#include \"ATtinySerialOut.hpp\" \/\/ Available as Arduino library \"ATtinySerialOut\". Saves 128 bytes program space\r\n\/\/ Pin 6 is TX pin 7 is RX\r\n#define IR_RECEIVE_PIN   3 \/\/ INT1\r\n#define IR_SEND_PIN      4\r\n#define TONE_PIN         9\r\n#define _IR_TIMING_TEST_PIN 8\r\n\r\n#elif defined(__AVR_ATtiny1616__)  || defined(__AVR_ATtiny3216__) || defined(__AVR_ATtiny3217__) \/\/ Tiny Core Dev board\r\n#define IR_RECEIVE_PIN  18\r\n#define IR_SEND_PIN     19\r\n#define TONE_PIN        20\r\n#define APPLICATION_PIN  0 \/\/ PA4\r\n#undef LED_BUILTIN         \/\/ No LED available on the TinyCore 32 board, take the one on the programming board which is connected to the DAC output\r\n#define LED_BUILTIN      2 \/\/ PA6\r\n\r\n#elif defined(__AVR_ATtiny1604__)\r\n#define IR_RECEIVE_PIN   2 \/\/ To be compatible with interrupt example, pin 2 is chosen here.\r\n#define IR_SEND_PIN      3\r\n#define APPLICATION_PIN  5\r\n\r\n#define tone(...) void()      \/\/ Define as void, since TCB0_INT_vect is also used by tone()\r\n#define noTone(a) void()\r\n#define TONE_PIN        42 \/\/ Dummy for examples using it\r\n\r\n#  elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \\\r\n|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \\\r\n|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \\\r\n|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \\\r\n|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \\\r\n|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \\\r\n|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__) \\\r\n|| defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) \\\r\n|| defined(__AVR_ATmega8515__) || defined(__AVR_ATmega162__)\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN        13\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n\r\n#elif defined(ARDUINO_ARCH_APOLLO3) \/\/ Sparkfun Apollo boards\r\n#define IR_RECEIVE_PIN  11\r\n#define IR_SEND_PIN     12\r\n#define TONE_PIN         5\r\n\r\n#elif defined(ARDUINO_ARCH_MBED) &amp;&amp; defined(ARDUINO_ARCH_MBED_NANO) \/\/ Arduino Nano 33 BLE\r\n#define IR_RECEIVE_PIN      3   \/\/ GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico\r\n#define IR_SEND_PIN         4   \/\/ GPIO16\r\n#define TONE_PIN            5\r\n#define APPLICATION_PIN     6\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 8\r\n\r\n#elif defined(ARDUINO_ARCH_RP2040) \/\/ Arduino Nano Connect, Pi Pico with arduino-pico core https:\/\/github.com\/earlephilhower\/arduino-pico\r\n#define IR_RECEIVE_PIN      15  \/\/ to be compatible with the Arduino Nano RP2040 Connect (pin3)\r\n#define IR_SEND_PIN         16\r\n#define TONE_PIN            17\r\n#define APPLICATION_PIN     18\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 20\r\n\r\n\/\/ If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN\r\n\/\/ and use the external reset with 1 kOhm to ground to enter UF2 mode\r\n\/\/#undef LED_BUILTIN\r\n\/\/#define LED_BUILTIN          6\r\n\r\n#elif defined(PARTICLE) \/\/ !!!UNTESTED!!!\r\n#define IR_RECEIVE_PIN      A4\r\n#define IR_SEND_PIN         A5 \/\/ Particle supports multiple pins\r\n\r\n#define LED_BUILTIN         D7\r\n\r\n\/*\r\n * 4 times the same (default) layout for easy adaption in the future\r\n *\/\r\n#elif defined(TEENSYDUINO)\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN         3\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n\r\n#elif defined(__AVR__) \/\/ Default as for ATmega328 like on Uno, Nano etc.\r\n#define IR_RECEIVE_PIN      2 \/\/ To be compatible with interrupt example, pin 2 is chosen here.\r\n#define IR_SEND_PIN         3\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n\r\n#  if defined(ARDUINO_AVR_PROMICRO) \/\/ Sparkfun Pro Micro is __AVR_ATmega32U4__ but has different external circuit\r\n\/\/ We have no built in LED at pin 13 -&gt; reuse RX LED\r\n#undef LED_BUILTIN\r\n#define LED_BUILTIN         LED_BUILTIN_RX\r\n#  endif\r\n\r\n#elif defined(ARDUINO_ARCH_MBED) \/\/ Arduino Nano 33 BLE\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN         3\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n\r\n#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN         3\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n\r\n\/\/ On the Zero and others we switch explicitly to SerialUSB\r\n#define Serial SerialUSB\r\n\r\n\/\/ Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13\/PA17.\r\n\/\/ Attention!!! D2 and D4 are switched on these boards!!!\r\n\/\/ If you connect the LED, it is on pin 24\/PB11. In this case activate the next two lines.\r\n\/\/#undef LED_BUILTIN\r\n\/\/#define LED_BUILTIN 24 \/\/ PB11\r\n\/\/ As an alternative you can choose pin 25, it is the RX-LED pin (PB03), but active low.In this case activate the next 3 lines.\r\n\/\/#undef LED_BUILTIN\r\n\/\/#define LED_BUILTIN 25 \/\/ PB03\r\n\/\/#define FEEDBACK_LED_IS_ACTIVE_LOW \/\/ The RX LED on the M0-Mini is active LOW\r\n\r\n#elif defined (NRF51) \/\/ BBC micro:bit\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN         3\r\n#define APPLICATION_PIN     1\r\n#define _IR_TIMING_TEST_PIN 4\r\n\r\n#define tone(...) void()    \/\/ no tone() available\r\n#define noTone(a) void()\r\n#define TONE_PIN           42 \/\/ Dummy for examples using it\r\n\r\n#else\r\n#warning Board \/ CPU is not detected using pre-processor symbols -&gt; using default values, which may not fit. Please extend PinDefinitionsAndMore.h.\r\n\/\/ Default valued for unidentified boards\r\n#define IR_RECEIVE_PIN      2\r\n#define IR_SEND_PIN         3\r\n#define TONE_PIN            4\r\n#define APPLICATION_PIN     5\r\n#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 \/\/ E.g. used for examples which use LED_BUILDIN for example output.\r\n#define _IR_TIMING_TEST_PIN 7\r\n#endif \/\/ defined(ESP8266)\r\n\r\n#if !defined (FLASHEND)\r\n#define FLASHEND 0xFFFF \/\/ Dummy value for platforms where FLASHEND is not defined\r\n#endif\r\n\/*\r\n * Helper macro for getting a macro definition as string\r\n *\/\r\n#if !defined(STR_HELPER)\r\n#define STR_HELPER(x) #x\r\n#define STR(x) STR_HELPER(x)\r\n#endif<\/pre>\n<hr \/>\n<p>ReceiveDemo<\/p>\n<pre class=\"lang:default decode:true \">\/*\r\n * ReceiveDemo.cpp\r\n *\r\n * Demonstrates receiving IR codes with the IRremote library.\r\n * If debug button is pressed (pin connected to ground) a long output is generated.\r\n *\r\n *  This file is part of Arduino-IRremote https:\/\/github.com\/Arduino-IRremote\/Arduino-IRremote.\r\n *\r\n ************************************************************************************\r\n * MIT License\r\n *\r\n * Copyright (c) 2020-2022 Armin Joachimsmeyer\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and\/or sell\r\n * copies of the Software, and to permit persons to whom the Software is furnished\r\n * to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\r\n * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\r\n * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\r\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\r\n * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\r\n * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n *\r\n ************************************************************************************\r\n *\/\r\n\r\n#include &lt;Arduino.h&gt;\r\n\r\n\/*\r\n * Specify which protocol(s) should be used for decoding.\r\n * If no protocol is defined, all protocols are active.\r\n * This must be done before the #include &lt;IRremote.hpp&gt;\r\n *\/\r\n\/\/#define DECODE_LG\r\n\/\/#define DECODE_NEC\r\n\/\/ etc. see IRremote.hpp\r\n\/\/\r\n\r\n#define RAW_BUFFER_LENGTH  750  \/\/ 750 is the value for air condition remotes.\r\n\r\n\/\/#define NO_LED_FEEDBACK_CODE \/\/ saves 92 bytes program space\r\n#if FLASHEND &lt;= 0x1FFF  \/\/ For 8k flash or less, like ATtiny85. Exclude exotic protocols.\r\n#define EXCLUDE_EXOTIC_PROTOCOLS\r\n#  if !defined(DIGISTUMPCORE) \/\/ ATTinyCore is bigger than Digispark core\r\n#define EXCLUDE_UNIVERSAL_PROTOCOLS \/\/ Saves up to 1000 bytes program space.\r\n#  endif\r\n#endif\r\n\/\/#define EXCLUDE_UNIVERSAL_PROTOCOLS \/\/ Saves up to 1000 bytes program space.\r\n\/\/#define EXCLUDE_EXOTIC_PROTOCOLS \/\/ saves around 650 bytes program space if all other protocols are active\r\n\/\/#define _IR_MEASURE_TIMING\r\n\r\n\/\/ MARK_EXCESS_MICROS is subtracted from all marks and added to all spaces before decoding,\r\n\/\/ to compensate for the signal forming of different IR receiver modules.\r\n\/\/#define MARK_EXCESS_MICROS    20 \/\/ 20 is recommended for the cheap VS1838 modules\r\n\r\n\/\/#define RECORD_GAP_MICROS 12000 \/\/ Activate it for some LG air conditioner protocols\r\n\r\n\/\/#define DEBUG \/\/ Activate this for lots of lovely debug output from the decoders.\r\n#define INFO \/\/ To see valuable informations from universal decoder for pulse width or pulse distance protocols\r\n\/*\r\n * First define macros for input and output pin etc.\r\n *\/\r\n#include \"PinDefinitionsAndMore.h\"\r\n#include &lt;IRremote.hpp&gt;\r\n\r\n#if defined(APPLICATION_PIN)\r\n#define DEBUG_BUTTON_PIN    APPLICATION_PIN \/\/ if low, print timing for each received data set\r\n#else\r\n#define DEBUG_BUTTON_PIN   6\r\n#endif\r\n\r\n\/\/ On the Zero and others we switch explicitly to SerialUSB\r\n#if defined(ARDUINO_ARCH_SAMD)\r\n#define Serial SerialUSB\r\n#endif\r\n\r\nvoid setup() {\r\n#if defined(_IR_MEASURE_TIMING) &amp;&amp; defined(_IR_TIMING_TEST_PIN)\r\n    pinMode(_IR_TIMING_TEST_PIN, OUTPUT);\r\n#endif\r\n#if FLASHEND &gt;= 0x3FFF  \/\/ For 16k flash or more, like ATtiny1604. Code does not fit in program space of ATtiny85 etc.\r\n    pinMode(DEBUG_BUTTON_PIN, INPUT_PULLUP);\r\n#endif\r\n\r\n    Serial.begin(115200);\r\n#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)\r\n    delay(4000); \/\/ To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!\r\n#endif\r\n\/\/ Just to know which program is running on my Arduino\r\n    Serial.println(F(\"START \" __FILE__ \" from \" __DATE__ \"\\r\\nUsing library version \" VERSION_IRREMOTE));\r\n\r\n\/\/ In case the interrupt driver crashes on setup, give a clue\r\n\/\/ to the user what's going on.\r\n    Serial.println(F(\"Enabling IRin...\"));\r\n\r\n    \/\/ Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED\r\n    IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);\r\n\r\n    Serial.print(F(\"Ready to receive IR signals of protocols: \"));\r\n    printActiveIRProtocols(&amp;Serial);\r\n    Serial.print(F(\"at pin \"));\r\n#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)\r\n    Serial.println(IR_RECEIVE_PIN_STRING);\r\n#else\r\n    Serial.println(IR_RECEIVE_PIN);\r\n#endif\r\n\r\n#if FLASHEND &gt;= 0x3FFF  \/\/ For 16k flash or more, like ATtiny1604. Code does not fit in program space of ATtiny85 etc.\r\n    Serial.print(F(\"Debug button pin is \"));\r\n    Serial.println(DEBUG_BUTTON_PIN);\r\n\r\n    \/\/ infos for receive\r\n    Serial.print(RECORD_GAP_MICROS);\r\n    Serial.println(F(\" us is the (minimum) gap, after which the start of a new IR packet is assumed\"));\r\n    Serial.print(MARK_EXCESS_MICROS);\r\n    Serial.println(F(\" us are subtracted from all marks and added to all spaces for decoding\"));\r\n#endif\r\n\r\n}\r\n\r\nvoid loop() {\r\n    \/*\r\n     * Check if received data is available and if yes, try to decode it.\r\n     * Decoded result is in the IrReceiver.decodedIRData structure.\r\n     *\r\n     * E.g. command is in IrReceiver.decodedIRData.command\r\n     * address is in command is in IrReceiver.decodedIRData.address\r\n     * and up to 32 bit raw data in IrReceiver.decodedIRData.decodedRawData\r\n     *\/\r\n    if (IrReceiver.decode()) {\r\n        Serial.println();\r\n#if FLASHEND &gt;= 0x3FFF  \/\/ For 16k flash or more, like ATtiny1604\r\n        if (IrReceiver.decodedIRData.flags &amp; IRDATA_FLAGS_WAS_OVERFLOW) {\r\n            Serial.println(F(\"Overflow detected\"));\r\n            Serial.println(F(\"Try to increase the \\\"RAW_BUFFER_LENGTH\\\" value of \" STR(RAW_BUFFER_LENGTH) \" in \" __FILE__));\r\n            \/\/ see also https:\/\/github.com\/Arduino-IRremote\/Arduino-IRremote#modifying-compile-options-with-sloeber-ide\r\n#  if !defined(ESP8266) &amp;&amp; !defined(NRF5)\r\n            \/*\r\n             * do double beep\r\n             *\/\r\n#    if !defined(ESP32)\r\n            IrReceiver.stop(); \/\/ ESP32 uses another timer for tone()\r\n#    endif\r\n            tone(TONE_PIN, 1100, 10);\r\n            delay(50);\r\n            tone(TONE_PIN, 1100, 10);\r\n            delay(50);\r\n#    if !defined(ESP32)\r\n            IrReceiver.start(100000); \/\/ to compensate for 100 ms stop of receiver. This enables a correct gap measurement.\r\n#    endif\r\n#  endif\r\n\r\n        } else {\r\n            \/\/ Print a short summary of received data\r\n            IrReceiver.printIRResultShort(&amp;Serial);\r\n\r\n            if (IrReceiver.decodedIRData.protocol == UNKNOWN || digitalRead(DEBUG_BUTTON_PIN) == LOW) {\r\n                \/\/ We have an unknown protocol, print more info\r\n                IrReceiver.printIRResultRawFormatted(&amp;Serial, true);\r\n            }\r\n        }\r\n\r\n        \/\/ tone on esp8266 works once, then it disables the successful IrReceiver.start() \/ timerConfigForReceive().\r\n#  if !defined(ESP8266) &amp;&amp; !defined(NRF5)\r\n        if (IrReceiver.decodedIRData.protocol != UNKNOWN) {\r\n            \/*\r\n             * If a valid protocol was received, play tone, wait and restore IR timer.\r\n             * Otherwise do not play a tone to get exact gap time between transmissions.\r\n             * This will give the next CheckForRecordGapsMicros() call a chance to eventually propose a change of the current RECORD_GAP_MICROS value.\r\n             *\/\r\n#    if !defined(ESP32)\r\n            IrReceiver.stop(); \/\/ ESP32 uses another timer for tone()\r\n#    endif\r\n            tone(TONE_PIN, 2200, 8);\r\n#    if !defined(ESP32)\r\n            delay(8);\r\n            IrReceiver.start(8000); \/\/ to compensate for 8 ms stop of receiver. This enables a correct gap measurement.\r\n#    endif\r\n        }\r\n#  endif\r\n#else\r\n        \/\/ Print a minimal summary of received data\r\n        IrReceiver.printIRResultMinimal(&amp;Serial);\r\n#endif \/\/ FLASHEND\r\n\r\n        \/*\r\n         * !!!Important!!! Enable receiving of the next value,\r\n         * since receiving has stopped after the end of the current received data packet.\r\n         *\/\r\n        IrReceiver.resume();\r\n\r\n        \/*\r\n         * Finally check the received data and perform actions according to the received address and commands\r\n         *\/\r\n        if (IrReceiver.decodedIRData.address == 0) {\r\n            if (IrReceiver.decodedIRData.command == 0x10) {\r\n                \/\/ do something\r\n            } else if (IrReceiver.decodedIRData.command == 0x11) {\r\n                \/\/ do something else\r\n            }\r\n        }\r\n    } \/\/ if (IrReceiver.decode())\r\n\r\n    \/*\r\n     * Your code here\r\n     * For all users of the FastLed library, use this code for strip.show() to improve receiving performance (which is still not 100%):\r\n     * if (IrReceiver.isIdle()) {\r\n     *     strip.show();\r\n     * }\r\n     *\/\r\n\r\n}<\/pre>\n<hr \/>\n<p style=\"text-align: left;\"><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><\/p>\n<hr \/>\n<p style=\"text-align: left;\"><strong>PROYECTO RECOMENDADO<\/strong><\/p>\n<p><iframe loading=\"lazy\" title=\"Controla tus aparatos electr\u00f3nicos infrarrojos por wifi con esp32  - PCBWay.es\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/itjfyOT7yp4?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>En este tutorial veremos como controlar un aire acondicionado, con un esp32 y la aplicaci\u00f3n telegram, desde cualquier parte del mundo, donde tengamos acceso a internet. El dispositivo, puede capturar con un m\u00f3dulo receptor infrarrojo, los comandos de un aire acondicionado, y en este proyecto controlaremos el encendido y apagado con la aplicaci\u00f3n telegram, pero [&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":6812,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[1373,1374,1067,1372,1371,181,906,772,1376,595,1071,1070,1069,624,465,1370,1375,380,1367,1368,1174,613,1068,1066,917,1377,31,1089,687,921],"_links":{"self":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6811"}],"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=6811"}],"version-history":[{"count":3,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6811\/revisions"}],"predecessor-version":[{"id":6828,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6811\/revisions\/6828"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media\/6812"}],"wp:attachment":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media?parent=6811"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/categories?post=6811"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/tags?post=6811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}