Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*PROJETO AUTOMAÇÃO 1.5 (QUARTO)
- Ajuda a desenvolver e dicas no codigo
- Rui Viana lab de garagem , Marcos Lab de garabem e
- Romario de Jesus Santana lab de garagem
- sinceros agradecimentos a todos*/
- //CONTROLE REMOTO
- #include <IRremote.h>
- #include <SPI.h>
- #include <Ethernet.h> //W5100
- #define RECV_PIN 2
- IRsend irsend;
- //define receptor IR
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- bool rele4=true, rele5=true;//variaveis para estado do rele
- byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
- IPAddress ip(192, 168, 1, 177);
- EthernetServer server(80);
- //RELES
- #define pino_rele4 4 // Luz Quarto
- #define pino_rele5 5 // Luz do banheiro
- /// Home Teather//
- unsigned int S_pwr[67] = {4500, 4350, 650, 1600, 600, 1600, 650, 450, 600, 500, 650, 500, 600, 500, 600, 1600, 600, 500, 650, 1600, 600, 1600, 600, 500, 600, 500, 650, 1600, 600, 500, 600, 1600, 650, 450, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 500, 650, 450, 650, 500, 600, 500, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 1600, 600, 1650, 600, 1600, 600, 1600, 650,};
- unsigned int S_fca[67] = {4550, 4350, 650, 1600, 600, 1600, 650, 450, 650, 450, 600, 550, 600, 500, 600, 1600, 650, 450, 600, 1650, 600, 1600, 600, 500, 600, 500, 650, 1600, 600, 500, 600, 1600, 650, 450, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 1600, 600, 550, 600, 500, 600, 500, 600, 500, 650 , 1550, 650, 1600, 600, 1600, 600, 500, 650, 1600, 600, 1600, 600, 1600, 600,};
- unsigned int S_vol[67] = {4500, 4400, 600, 1650, 550, 1650, 600, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 1600, 600, 550, 600, 1600, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 500, 600, 550, 600, 1600, 600, 500, 600, 500, 600, 550, 550, 1650, 600, 1600, 600,};
- unsigned int S_volm[67] = {4500, 4400, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 1600, 600, 1650, 600, 500, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 1600, 600,};
- unsigned int S_ant[67] = {4550, 4350, 600, 1600, 600, 1600, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 650, 1550, 650, 1600, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 1600, 600, 500, 650, 1600, 600, 1600, 650, 450, 650, 1600, 600, 1600, 650, 450, 650, 500, 600, 500, 600, 500, 650, 450, 650, 1600, 600, 500, 600, 500, 600, 1600, 650, 1600, 650, 1550, 650,};
- unsigned int S_ava[67] = {4500, 4400, 550, 1650, 600, 1600, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 500, 550, 550, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 1650, 600, 1600, 550, 1650, 600,};
- unsigned int S_pla[67] = {4500, 4400, 550, 1650, 600, 1600, 600, 500, 600, 500, 600, 550, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 500, 550, 550, 600, 500, 600, 500, 600, 500, 600, 1650, 600, 1600, 600, 500, 600, 1650, 600, 1600, 550, 1650, 600,};
- unsigned int S_cim[67] = {4500, 4400, 550, 1700, 550, 1650, 550, 550, 550, 550, 550, 600, 550, 550, 550, 1650, 550, 550, 550, 1700, 550, 1650, 550, 550, 550, 550, 550, 1700, 550, 550, 550, 1650, 550, 600, 550, 1650, 550, 550, 550, 1650, 550, 1700, 550, 550, 550, 550, 550, 550, 550, 600, 550, 550, 550, 1650, 550, 550, 550, 600, 550, 1650, 550, 1650, 550, 1700, 550, 1650, 550,};
- unsigned int S_bai[67] = {4550, 4350, 650, 1600, 600, 1600, 650, 450, 600, 500, 650, 450, 650, 500, 600, 1600, 650, 450, 650, 1600, 600, 1600, 650, 450, 650, 450, 650, 1600, 600, 500, 650, 1550, 600, 500, 650, 1600, 600, 500, 650, 1550, 650, 500, 600, 500, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 500, 650, 1550, 650, 1600, 600, 1600, 600, 1650, 600, 1600, 600,};
- /// ar condicionado
- unsigned int des_ar[59] = {3208, 9548, 608, 1444, 608, 412, 604, 408, 604, 408, 604, 1448, 604, 432, 604, 412, 604, 408, 608, 1420, 608, 1420, 604, 432, 584, 428, 608, 408, 604, 412, 604, 408, 608, 428, 584, 432, 580, 432, 580, 432, 584, 432, 580, 432, 584, 1444, 580, 432, 580, 1448, 492, 520, 524, 492, 604, 432, 584, 1444, 580,};
- unsigned int modo_ar[59] = {3168, 9640, 524, 1500, 576, 444, 548, 464, 548, 464, 552, 1476, 548, 488, 524, 488, 528, 488, 524, 488, 496, 516, 500, 516, 520, 496, 520, 1528, 524, 492, 520, 1508, 520, 492, 520, 496, 520, 492, 520, 1528, 500, 1556, 496, 516, 496, 1528, 500, 516, 572, 440, 496, 516, 500, 516, 496, 516, 552, 1476, 520,};
- unsigned int velocidade_ar[61] = {368, 43108, 3152, 9604, 580, 1472, 524, 492, 552, 460, 552, 460, 556, 1472, 552, 464, 576, 436, 576, 436, 580, 1448, 580, 456, 556, 1472, 556, 456, 580, 436, 576, 436, 608, 408, 604, 432, 580, 1448, 604, 432, 584, 1444, 580, 1448, 580, 436, 600, 1448, 580, 436, 572, 440, 572, 1456, 572, 468, 544, 468, 544, 1484, 544,};
- unsigned int aumenta_ar[59] = {3196, 9612, 572, 1452, 524, 516, 500, 512, 500, 516, 496, 1532, 520, 496, 520, 516, 496, 516, 572, 440, 576, 440, 572, 440, 576, 440, 548, 1476, 576, 436, 576, 464, 500, 516, 496, 1528, 500, 516, 496, 516, 576, 1456, 520, 492, 520, 1528, 500, 516, 496, 516, 500, 512, 576, 1452, 572, 440, 520, 1532, 500,};
- unsigned int diminui_ar[59] = {3184, 9624, 552, 1504, 524, 488, 584, 428, 584, 432, 584, 1468, 604, 436, 584, 428, 584, 432, 584, 428, 584, 428, 584, 432, 584, 428, 584, 1468, 584, 428, 584, 432, 584, 428, 540, 1488, 608, 432, 584, 428, 496, 516, 500, 516, 496, 1556, 584, 428, 584, 428, 500, 516, 596, 1432, 608, 428, 500, 516, 608,};
- unsigned int lig_ar[59] = {3124, 9636, 552, 1500, 524, 492, 576, 436, 576, 436, 552, 1500, 528, 516, 496, 516, 500, 512, 580, 436, 544, 468, 572, 444, 572, 440, 552, 460, 580, 436, 576, 1448, 524, 496, 520, 496, 520, 492, 520, 1528, 500, 1528, 500, 512, 500, 1528, 500, 512, 552, 1504, 576, 1448, 580, 436, 520, 1512, 520, 492, 520,};
- void setup() {
- pinMode(pino_rele4, OUTPUT); // Quarto
- pinMode(pino_rele5, OUTPUT); // banheiro
- //Desliga os reles
- digitalWrite(pino_rele4, HIGH); // Quarto
- digitalWrite(pino_rele5, HIGH); // banheiro
- Ethernet.begin(mac, ip);
- server.begin();
- //Controle remoto mega pin 9
- pinMode(9, OUTPUT);
- digitalWrite(9, LOW);
- irrecv.enableIRIn();
- }
- void loop() {
- EthernetClient client = server.available();
- if (client) {
- String vars;
- byte acao = 0;
- boolean currentLineIsBlank = true;
- while (client.connected()) {
- if (client.available()) {
- char c = client.read();
- vars.concat(c);
- //Página Html//
- if (c == '\n') {
- client.println(F("HTTP/1.1 200 OK"));
- client.println(F("Content-Type: text/html"));
- client.println();
- client.println(F("<!doctype html>"));
- client.println(F("<head>"));
- client.println(F("<meta charset=\"utf-8\">"));
- client.println(F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\""));
- client.println(F("<title>Automação meu QUARTO</title>"));
- client.println(F("<meta name=\"viewport\" content=\"width=320\">"));
- client.println(F("<meta name=\"viewport\" content=\"width=device-width\">"));
- client.println(F("<meta charset=\"utf-8\">"));
- client.println(F("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">"));
- client.println(F("</head>"));
- client.println(F("<body>"));
- client.println(F("<center>"));
- client.println(F("<meta charset=\"utf-8\">"));
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">AUTOMAÇÃO</font>"));
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"blue\"> QUARTO</font><br />"));
- client.println(F("</center>"));
- ///REles
- client.println(F("<form action=\"/quarto\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On-Off Quarto</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/banheiro\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On-Off Banheiro</button> "));
- client.println(F("</form> <br />"));
- //// receptor
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Receptor</font>"));
- client.println(F("<form action=\"/receptor\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On Off Receptor</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/cima\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cima </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/setadireita\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Direita </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/setaesquerda\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Esquerda </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ok\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">oK </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/baixo\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Baixo </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/cenatv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cena - TV </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/exitre\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Exit</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/sleep\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Temporizador</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/recmenu\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Menu</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/favorito\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Favorito</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/1\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">1</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/2\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">2</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/3\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">3</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/4\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">4</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/5\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">5</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/6\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">6</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/7\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">7</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/8\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">8</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/9\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">9</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/0\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">0</button> "));
- client.println(F("</form> <br />"));
- ////controletv
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Tv</font>"));
- client.println(F("<form action=\"/tv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On-Off TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/input\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Input</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/setacima\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cima </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/setabaixo\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Baixo</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/esquerdatv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Esquerda </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/direitatv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Direita </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/volume+\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/volume-\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
- client.println(F("</form> <br />"));;
- client.println(F("<form action=\"/exittv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Exit TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/voltar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Voltar</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/mute\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Mudo</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/enter\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Enter</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/temp\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Temporizar TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/netflix\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Netflix</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/menutv\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Menu TV</button> "));
- client.println(F("</form> <br />"));
- /// CONTROLE HOME
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Home</font>"));
- client.println(F("<form action=\"/home\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On Off Home</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/funcao\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Função</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/volmenoshome\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/volmaishome\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/anterior\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Anterior</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/avancar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Avançar TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/play\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Play</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/btncim\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cima</button> "));
- client.println(F("</form> <br />"));
- /// apartir daqui nao funciona comando
- client.println(F("<form action=\"/btnbai\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Baixo</button> "));
- client.println(F("</form> <br />"));
- ///Controle ar Condicionado
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Ar Condicionado</font>"));
- client.println(F("<form action=\"/ligarar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On Ar</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/desliga_ar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Off Ar </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/modo\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Modo</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/velocidade\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Velocidade</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/menosar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Ar -</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/maisar\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Ar + </button> "));
- client.println(F("</form> <br />"));
- ///fita de led
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Fita de Led</font>"));
- client.println(F("<form action=\"/led\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Liga Led </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/aumenta\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Aumenta </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/diminui\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Diminui </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/azul\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Azul </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/vermelho\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vermelho </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/verde\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Verde </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/branco\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Branco </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/flash\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Flash </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/efei1\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 1 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/efei2\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 2 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/efei3\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 3 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/efei4\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 4 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/slow\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Slow </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/quick\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Quick</button> "));
- client.println(F("</form> <br />"));
- client.println(F(""));
- client.println(F("</center>"));
- client.println(F("</body>"));
- client.println(F("</html>"));
- break;
- }//final if \n
- }//final client.avaliable
- //AQUI ACONTECEM AS COMPARACOES(Receptor)
- /// if (vars.endsWith(F("/ligarec"))) acao = 2;
- if (vars.endsWith(F("/cenatv"))) acao = 3;
- else if (vars.endsWith(F("/ok"))) acao = 4;
- else if (vars.endsWith(F("/setadireita"))) acao = 5;
- else if (vars.endsWith(F("/setaesquerda"))) acao = 6;
- else if (vars.endsWith(F("/cima"))) acao = 7;
- else if (vars.endsWith(F("/baixo"))) acao = 8;
- else if (vars.endsWith(F("/exitre"))) acao = 9;
- else if (vars.endsWith(F("/sleep"))) acao=10;
- else if (vars.endsWith(F("/recmenu"))) acao=11;
- else if (vars.endsWith(F("/favorito"))) acao=12;
- else if (vars.endsWith(F("/1"))) acao=13;
- else if (vars.endsWith(F("/2"))) acao=14;
- else if (vars.endsWith(F("/3"))) acao=15;
- else if (vars.endsWith(F("/4"))) acao=16;
- else if (vars.endsWith(F("/5"))) acao=17;
- else if (vars.endsWith(F("/6"))) acao=18;
- else if (vars.endsWith(F("/7"))) acao=19;
- else if (vars.endsWith(F("/8"))) acao = 20;
- else if (vars.endsWith(F("/9"))) acao = 21;
- else if (vars.endsWith(F("/0"))) acao = 22;
- else if (vars.endsWith(F("/receptor"))) acao = 55;
- /// Rele
- else if (vars.endsWith(F("/quarto"))) acao = 23;
- else if (vars.endsWith(F("/banheiro"))) acao = 24;
- /// Controle TV
- else if (vars.endsWith(F("/tv"))) acao = 25;
- else if (vars.endsWith(F("/input"))) acao = 26;
- else if (vars.endsWith(F("/menutv"))) acao = 27;
- else if (vars.endsWith(F("/setacima"))) acao = 28;
- else if (vars.endsWith(F("/setabaixo"))) acao = 29;
- else if (vars.endsWith(F("/esquerdatv"))) acao = 30;
- else if (vars.endsWith(F("/direitatv"))) acao = 31;
- else if (vars.endsWith(F("/volume+"))) acao = 32;
- else if (vars.endsWith(F("/volume-"))) acao = 33;
- else if (vars.endsWith(F("/exittv"))) acao = 34;
- else if (vars.endsWith(F("/voltar"))) acao = 35;
- else if (vars.endsWith(F("/mutetv"))) acao = 36;
- else if (vars.endsWith(F("/temp"))) acao = 37;
- else if (vars.endsWith(F("/netflix"))) acao = 38;
- else if (vars.endsWith(F("/enter"))) acao = 39;
- /// Controle HOME
- else if (vars.endsWith(F("/home"))) acao = 40;
- else if (vars.endsWith(F("/funcao"))) acao = 41;
- else if (vars.endsWith(F("/volmenoshome"))) acao = 42;
- else if (vars.endsWith(F("/volmaishome"))) acao = 43;
- else if (vars.endsWith(F("/anterio"))) acao = 44;
- else if (vars.endsWith(F("/avancar"))) acao = 45;
- else if (vars.endsWith(F("/play"))) acao = 46;
- else if (vars.endsWith(F("/btncim"))) acao = 47;
- /// apartir daqui nao funciona comando
- else if (vars.endsWith(F("/btnbai"))) acao = 48;
- //Controle Ar
- else if (vars.endsWith(F("/ligarar"))) acao = 49;
- else if (vars.endsWith(F("/desliga_ar"))) acao = 50;
- else if (vars.endsWith(F("/modo"))) acao = 51;
- else if (vars.endsWith(F("/velocidade"))) acao = 52;
- else if (vars.endsWith(F("/maisar"))) acao = 53;
- else if (vars.endsWith(F("/menosar"))) acao = 54;
- /// fita led
- else if (vars.endsWith(F("/led"))) acao = 56;
- else if (vars.endsWith(F("/aumenta"))) acao = 57;
- else if (vars.endsWith(F("/diminui"))) acao = 58;
- else if (vars.endsWith(F("/azul"))) acao = 59;
- else if (vars.endsWith(F("/vermelho"))) acao = 60;
- else if (vars.endsWith(F("/verde"))) acao = 61;
- else if (vars.endsWith(F("/branco"))) acao = 62;
- else if (vars.endsWith(F("/flash"))) acao = 63;
- else if (vars.endsWith(F("/efei1"))) acao = 64;
- else if (vars.endsWith(F("/efei2"))) acao = 65;
- else if (vars.endsWith(F("/efei3"))) acao = 66;
- else if (vars.endsWith(F("/efei4"))) acao = 67;
- else if (vars.endsWith(F("/slow"))) acao = 68;
- else if (vars.endsWith(F("/quick"))) acao = 69;
- if (acao == 3) { //liga , DESLIGANDO A TV
- //Ligar receptor
- irsend.sendNEC(0xFF50AF, 32);
- delay(2000);
- //ligar tv
- irsend.sendNEC(0x2FD48B7, 32);
- acao = 0;
- }
- if (acao == 4) { //Ok
- irsend.sendNEC(0xFFB04F, 32);
- acao = 0;
- }
- if (acao == 5) { //SetaDiretia
- irsend.sendNEC(0xFF8877, 32);
- acao = 0;
- }
- if (acao == 6) { //seta esquerda
- irsend.sendNEC(0xFF08F7, 32);
- acao = 0;
- }
- if (acao == 7) { //Seta cima
- irsend.sendNEC(0xFFD02F, 32);
- acao = 0;
- }
- if (acao == 8) { //Seta baixo
- irsend.sendNEC(0xFF708F, 32);
- acao = 0;
- }
- if (acao == 9){ //exit
- irsend.sendNEC (0xFF7887, 32);
- acao = 0;
- }
- if (acao == 10){ //Sleep
- irsend.sendNEC(0xFF6C93, 32);
- acao = 0;
- }
- if (acao == 11){ //Menu
- irsend.sendNEC(0xFF58A7, 32);
- acao = 0;
- }
- if (acao == 12){ //Favorito
- irsend.sendNEC(0xFFEA15, 32);
- acao = 0;
- }
- if (acao == 14){ //2
- irsend.sendNEC(0xFF40BF, 32);
- acao = 0;
- }
- if (acao == 15){ //3
- irsend.sendNEC(0xFFC03F, 32);
- acao = 0;
- }
- if (acao == 16){ //4
- irsend.sendNEC(0xFF20DF, 32);
- acao = 0;
- }
- if (acao == 17){ //5
- irsend.sendNEC(0xFFA05F, 32);
- acao = 0;
- }
- if (acao == 18){ //6
- irsend.sendNEC(0xFF609F, 32);
- acao = 0;
- }
- if (acao == 19){ //7
- irsend.sendNEC(0xFFE01F, 32);
- acao = 0;
- }
- if (acao == 20){ //8
- irsend.sendNEC (0xFF10EF, 32);
- acao = 0;
- }
- if (acao == 21){ //9
- irsend.sendNEC(0xFF906F, 32);
- acao = 0;
- }
- if (acao == 22){ //0
- irsend.sendNEC(0xFF00FF, 32);
- acao = 0;
- }
- if (acao == 55) { //LIGANDO Receptor
- //Ligar receptor
- irsend.sendNEC(0xFF50AF, 32);
- }
- /// Reles
- if (acao == 24) { //Banheiro
- rele5 = !rele5;
- digitalWrite(pino_rele5, rele5);
- acao = 0;
- }
- if (acao == 23) { //Quarto
- rele4 = !rele4;
- digitalWrite(pino_rele4, rele4);
- acao = 0;
- }
- //acao tv
- if (acao == 25){ //ligar tv
- irsend.sendNEC(0x2FD48B7, 32);
- acao = 0;
- }
- if (acao == 26){ //input
- irsend.sendNEC(0x2FDF00F, 32);
- acao = 0;
- }
- if (acao == 27){ //menu
- irsend.sendNEC(0x2FD01FE, 32);
- acao = 0;
- }
- if (acao == 28){ //Cima
- irsend.sendNEC(0x2FD41BE, 32);
- acao = 0;
- }
- if (acao == 29){ //baixo
- irsend.sendNEC(0x2FDC13E, 32);
- acao = 0;
- }
- if (acao == 30){ //Esquerda
- irsend.sendNEC(0x2FDB847, 32);
- acao = 0;
- }
- if (acao == 31){ //Direita
- irsend.sendNEC(0x2FD9867, 32);
- acao = 0;
- }
- if (acao == 32){ //Vol +
- irsend.sendNEC(0x2FD58A7, 32);
- acao = 0;
- }
- if (acao == 33){ //vol -
- irsend.sendNEC(0x2FD7887, 32);
- acao = 0;
- }
- if (acao == 34){ //Exit
- irsend.sendNEC(0x2FD1AE5, 32);
- acao = 0;
- }
- if (acao == 35){ //Voltar
- irsend.sendNEC(0xFF00FF, 32);
- acao = 0;
- }
- if (acao == 36){ //mute
- irsend.sendNEC(0x2FD08F7, 32);
- acao = 0;
- }
- if (acao == 37){ //sleep
- irsend.sendNEC(0x2FDA857, 32);
- acao = 0;
- }
- if (acao == 38){ //netflix
- irsend.sendNEC(0x2FD54AB, 32);
- acao = 0;
- }
- if (acao == 39){ //enter
- irsend.sendNEC(0x2FD916E, 32);
- acao = 0;
- }
- /// Home
- if (acao == 40){ //ligar
- irsend.sendRaw(S_pwr, 67, 38);
- acao = 0;
- }
- if (acao == 41){ //funçao
- irsend.sendRaw(S_fca, 67, 38);
- acao = 0;
- }
- if (acao == 42){ //vol -
- irsend.sendRaw(S_vol, 67, 38);
- acao = 0;
- }
- if (acao == 43){ //vol +
- irsend.sendRaw(S_volm, 67, 38);
- acao = 0;
- }
- if (acao == 44){ //anterior
- irsend.sendRaw(S_ant, 67, 38);
- acao = 0;
- }
- if (acao == 45){ //avançar
- irsend.sendRaw(S_ava, 67, 38);
- acao = 0;
- }
- if (acao == 46){ //play
- irsend.sendRaw(S_pla, 67, 38);
- acao = 0;
- }
- if (acao == 47){ //cima
- irsend.sendRaw(S_cim, 67, 38);
- acao = 0;
- }
- /// apartir daqui nao funciona comando
- if (acao == 48){ //baixo
- irsend.sendRaw(S_bai, 67, 38);
- acao = 0;
- }
- //Ar condicionado
- if (acao == 49){ //ligar
- irsend.sendRaw(lig_ar, 59, 38);
- acao = 0;
- }
- if (acao == 50){ //desligar
- irsend.sendRaw(des_ar, 59, 38);
- acao = 0;
- }
- if (acao == 51){ //modo
- irsend.sendRaw(modo_ar, 59, 38);
- acao = 0;
- }
- if (acao == 52){ //velocidade
- irsend.sendRaw(velocidade_ar, 61, 38);
- acao = 0;
- }
- if (acao == 53){ //mais Ar
- irsend.sendRaw(aumenta_ar, 59, 38);
- acao = 0;
- }
- if (acao == 54){ //menos ar
- irsend.sendRaw(diminui_ar, 59, 38);
- acao = 0;
- }
- // Fita Led
- if (acao ==56){ // liga Fita Led
- irsend.sendNEC(0xFF02FD, 32);
- acao = 0;
- }
- if (acao ==57){ //aumentaFita Led
- irsend.sendNEC(0xFF3AC5, 32);
- acao = 0;
- }
- if (acao ==58){ // diminii Fita Led
- irsend.sendNEC(0xFFBA45, 32);
- acao = 0;
- }
- if (acao ==59){ // azul Fita Led
- irsend.sendNEC(0xFF1AE5, 32);
- acao = 0;
- }
- if (acao ==60){ // vermelho Fita Led
- irsend.sendNEC(0xFF9A65, 32);
- acao = 0;
- }
- if (acao ==61){ // verde Fita Led
- irsend.sendNEC(0xFFA25D, 32);
- acao = 0;
- }
- if (acao ==62){ // branco Fita Led
- irsend.sendNEC(0xFF22DD, 32);
- acao = 0;
- }
- if (acao ==63){ // flash Fita Led
- irsend.sendNEC(0xFFD02F, 32);
- acao = 0;
- }
- if (acao ==64){ // efeito 1 Fita Led
- irsend.sendNEC(0xFF20DF, 32);
- acao = 0;
- }
- if (acao ==65){ // efeito 2 Fita Led
- irsend.sendNEC(0xFFA05F, 32);
- acao = 0;
- }
- if (acao ==66){ // efeito 3 Fita Led
- irsend.sendNEC(0xFF609F, 32);
- acao = 0;
- }
- if (acao ==67){ // efeito 4 Fita Led
- irsend.sendNEC(0xFFE01F, 32);
- acao = 0;
- }
- if (acao ==68){ // Slow Fita Led
- irsend.sendNEC(0xFFC837, 32);
- acao = 0;
- }
- if (acao ==69){ // Quick Fita Led
- irsend.sendNEC(0xFFE817, 32);
- acao = 0;
- }
- ///////// // //// luz no controle ////////////////
- if (irrecv.decode(&results))
- {
- Serial.println(results.value, HEX);
- if (results.value == 0xFF946B) // LIGA QUARTO//
- {
- digitalWrite(pino_rele4, HIGH);
- }
- if (results.value == 0xFF0CF3) // DESLIGA QUARTO
- {
- digitalWrite(pino_rele4, LOW);
- }
- if (results.value == 0xFF8C73) // LIGA BANHEIRO//
- {
- digitalWrite(pino_rele5, HIGH);
- }
- if (results.value == 0xFF4CB3) // DESLIGA BANHEIRO //
- {
- digitalWrite(pino_rele5, LOW);
- }
- irrecv.resume();
- }
- ///////
- } //Final do if
- delay(1);
- irrecv.enableIRIn();
- client.stop();
- } //Final do if client
- }//LOOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement