Paso 3: Envío de comandos IR a aire acond.
#include "IRremote.h"
Irsend de IRsend;
void setup()
{
Serial.Begin(9600);
}
int khz = 38; Nota cambiar este valor por defecto según sea necesario para la correcta modulación de la frecuencia
ON y 2O º C con 1 ventilador calefacción
unsigned heat[] = {3000,3000,3000,4400,550,1600,600,550,550,1650,550,550,550,550,550,1650,550,550,550,1650,500,550,550,1650,550,550,550,500,600,500,600,550,550,550,550,1650,500,550,550,600,500,1700,500,550,550,550,550,550,550,600,500,550,550,550,550,550,550,550,550,1650,550,1650,550,1650,500,1650,550,1650,550,550,550,550,550,550,550,550,550,1650,550,1650,550,500,550,550,550,1700,500,1650,550,550,550,500,600,550,550,550,550,550,550,550,550,550,550,1650,500,1700,500,550,550,550,550,550,550,550,550,550,550,600,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,500,550,1700,500,550,550,550,550,550,550,1650,550};
APAGADO el aire acondicionado
unsigned OFF[] = {3100,2900,2950,4400,700,1500,700,400,700,1500,700,400,650,450,550,1650,550,550,650,1500,600,500,600,1600,600,500,600,500,600,450,650,450,600,550,550,550,550,550,550,600,500,1600,600,500,600,500,600,550,550,500,600,500,600,550,550,550,550,1600,600,500,600,500,600,500,550,1650,550,1600,600,500,600,500,600,550,550,550,550,1600,600,1600,550,550,550,550,550,1650,550,1600,600,550,550,500,600,500,600,550,550,550,550,500,600,500,600,1600,600,1600,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,500,600,550,550,550,550,500,600,500,600,500,600,1600,600,500,600,1600,550,550,550,1600,600,550,550,550,550};
ON y 23° con frío de ventilador 2
unsigned cold[] = {3050,3000,3000,4400,550,1600,600,550,550,1650,550,550,550,550,550,1650,550,500,600,1600,550,550,550,1650,550,1650,550,1650,550,550,550,550,550,500,600,1600,550,550,550,550,550,1650,550,550,550,550,550,550,550,550,550,550,550,550,550,500,600,1650,500,550,550,600,500,1700,500,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,1650,550,550,550,500,550,1650,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,550,550,550,550,550,550,550,550,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,1600,600,550,550};
ON y 20 C ° con 1 ventilador calefacción y SWING
unsigned heat_with_swing[] = {3000,3000,3000,4400,550,1650,550,500,600,1600,600,500,600,500,600,1600,550,550,550,1650,550,500,600,1600,600,550,550,550,550,550,550,1600,600,500,600,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,550,550,1600,550,550,550,600,500,550,550,550,550,550,550,550,550,550,550,1650,550,1650,550,550,550,550,550,1600,550,1650,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,1650,550,550,550,550,550,550,550,550,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,1650,550,1650,500,1650,550,550,550,1700,500};
ON y 23° con 2 ventilador frío y SWING
unsigned cold_with_sqwing[] = {2950,3050,2950,4400,550,1600,600,550,550,1650,550,550,550,550,550,1600,600,500,600,1600,550,500,600,1650,550,1650,550,1600,600,500,600,1600,600,500,600,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,500,600,550,550,500,600,1650,550,550,550,1600,600,500,600,1600,550,1600,600,500,600,500,600,550,550,500,600,1650,550,1600,600,500,600,500,550,1650,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,500,600,500,600,500,600,500,600,500,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,550,1650,550,1650,550,1600,600,1600,550,550,600,500,550,550,550,550,550};
void loop() {}
irsend.sendRaw (calor, sizeof(heat)/sizeof(int), khz);
Delay(10000);
irsend.sendRaw (OFF, sizeof(OFF)/sizeof(int),khz);
Delay(10000);
}
Si salimos a operar el aire acondicionado en casa, estamos bien en pista para completar el proyecto.
Como se indicó anteriormente, es necesario utilizar Arduino dos, uno que administra el servidor Web, el otro que gestiona la comunicación con el aire acondicionado.
Para conectar el Arduino dos de manera correcta, se debe tener cuidado para la siguiente imagen.
En el dispositivo conectado a la Ethernet Shield es necesario cargar el programa que lleva el nombre de AC_Webpage_Controller.ino, mientras nell'Arduino que van a enviar comandos IR, debe cargar el programa que lleva el nombre de AC_Sender_Code.ino. Usted puede encontrar el software en mi repositorio de Github https://github.com/jackbell16/AC-Progetto-Arduino/tree/master/Arduino_Code
Ahora que hemos completado el proceso de carga, tenemos a hacer algunos trabajos para mejorar el proyecto, el más útil, es para que sea accesible desde un servidor Web remoto. Que debemos "abrir las puertas" de nuestro router para enrutar correctamente las solicitudes que se realizan fuera de nuestra red local.
Debe indicarse que en la versión del código en Github registrado, no hay ninguna contraseña de nivel de seguridad, para simplificar un poco ' el proyecto. Sin embargo, con algunas modificaciones al código de AC_Webpage_Controller.ino, también puede implementar esta característica.