Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h> // Controle Remoto
- #include <SPI.h>
- #include<Ethernet.h>
- int flag = 0; // < < ----------------------------------------------------------------
- byte mac[] = {
- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEF
- };
- IPAddress ip(192, 168, 15, 177);
- EthernetServer server(80);
- #include <LiquidCrystal.h>
- LiquidCrystal lcd(22, 24, 26, 28, 30, 32);
- ///sensor de chuva
- int chuva; // Variavel do sensor
- int PinSensor = 0;
- int Porcento = 0;
- //RELES
- int rele1 = 4; //Quarto
- int rele2 = 5; //Banheiro
- int rele3 = 6; //Escada
- String readString;
- IRsend irsend; // Arduino Uno porta 3 e Arduino Mega porta 9 (default)
- //HOME
- 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() {
- lcd.begin(16, 2); //Inicia o LCD com dimensões 16x2(Colunas x Linhas)
- lcd.print("Automacao Lucas");
- lcd.setCursor(0, 1);
- pinMode(13, OUTPUT);
- // Desabilitando SPI - W5100
- pinMode(10, OUTPUT);
- digitalWrite(10, HIGH);
- // Desabilitando SPI - micro-SD
- pinMode(4, OUTPUT);
- digitalWrite(4, HIGH);
- Serial.begin(9600);
- //Começa a conexão com o Ethernet e o Servidor
- Ethernet.begin(mac, ip);
- server.begin();
- //Iniciando os relés
- pinMode(rele1, OUTPUT); //quarto
- pinMode(rele2, OUTPUT); //banheiro
- pinMode(rele3, OUTPUT); ///escada
- //Desligando os relés
- digitalWrite(rele1, HIGH); //quarto
- digitalWrite(rele2, HIGH); //banheiro
- digitalWrite(rele3, HIGH); //escada
- Serial.print("IP do Arduino: ");
- Serial.println(Ethernet.localIP());
- } // Setup()
- void loop() {
- //////PARTE DO SENSOR DE CHUVA/////
- chuva = analogRead(PinSensor);
- Porcento = map(chuva, 1023, 0, 0, 100);
- lcd.setCursor( 1, 0);
- lcd.println("Automacao Lucas");
- lcd.setCursor(0, 1);
- lcd.print(Porcento);
- lcd.println("% ");
- delay(1000);
- if (Porcento >= 25)
- {
- if (flag == 0 ) // < < ----------------------------------------------------------------
- { // < < ----------------------------------------------------------------
- lcd.setCursor(7, 1);
- lcd.println("Chovendo!");
- digitalWrite(7, HIGH);
- delay(1500);
- digitalWrite(7, LOW);
- delay(1000);
- lcd.clear();
- flag = 1; // < < ----------------------------------------------------------------
- } // < < ----------------------------------------------------------------
- }
- else
- {
- digitalWrite(7, LOW);
- flag = 0; // < < ----------------------------------------------------------------
- }
- /////////////////FIM DO SENSOR DE CHUVA/////////////
- //ouvir os clientes recebido (conectados)
- EthernetClient client = server.available();
- if (client) {
- while (client.connected()) {
- if (client.available()) {
- char c = client.read();
- if (readString.length() < 100) {
- readString += c;
- }
- //AQUI INICIA AS COMPARAÇÕES
- if (c == 'n')
- {
- //Ligar o Rele 1 ou Rele 2
- ///QUARTO
- if (readString.indexOf("quarto") > 0)
- {
- digitalWrite(rele1, !digitalRead(rele1)); //Invertendo o estado do relé
- Serial.println("quarto");
- lcd.setCursor(0, 1);
- lcd.print(" Luz do Quarto ");
- }
- //BANHEIRO
- else if (readString.indexOf("bide") > 0)
- {
- digitalWrite(rele2, !digitalRead(rele2)); //Invertendo o estado do relé
- Serial.println("banheiro");
- lcd.setCursor(0, 1);
- lcd.print(" Luz Banheiro ");
- }
- //ESCADA
- else if (readString.indexOf("escada") > 0)
- {
- digitalWrite(rele3, !digitalRead(rele3)); //Invertendo o estado do relé
- Serial.println("escada");
- lcd.setCursor(0, 1);
- lcd.print(" Luz da Escada ");
- }
- ///RECEPTOR
- else if (readString.indexOf("receptor") > 0) // Ligar e Desligar TV
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF50AF, 32); //Ligar TV
- Serial.println("Receptor");
- lcd.setCursor(0, 1);
- lcd.print(" Receptor ");
- } //for
- }
- else if (readString.indexOf("ok") > 0) // OK
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFB04F, 32);
- Serial.println("ok");
- lcd.setCursor(0, 1);
- lcd.print(" OK ");
- } //for
- }
- else if (readString.indexOf("direita") > 0) // Direita
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF8877, 32);
- Serial.println("direita");
- lcd.setCursor(0, 1);
- lcd.print(" Direita ");
- } //for
- }
- else if (readString.indexOf("esquerda") > 0) // Esquerda
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF08F7, 32);
- Serial.println("esquerda");
- lcd.setCursor(0, 1);
- lcd.print(" Esquerda ");
- }
- } //for
- else if (readString.indexOf("cima") > 0) // Cima
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFD02F, 32);
- Serial.println("cima");
- lcd.setCursor(0, 1);
- lcd.print(" Cima ");
- }
- } //for
- else if (readString.indexOf("baixo") > 0) // Baixo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF708F, 32);
- Serial.println("baixo");
- lcd.setCursor(0, 1);
- lcd.print(" Baixo ");
- }
- } //for
- else if (readString.indexOf("ex") > 0) // exit
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC (0xFF7887, 32);
- Serial.println("exit");
- lcd.setCursor(0, 1);
- lcd.print(" Sair ");
- }
- } //for
- else if (readString.indexOf("sleep") > 0) // Sleep
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF6C93, 32);
- Serial.println("sleep");
- lcd.setCursor(0, 1);
- lcd.print(" Sleep ");
- }
- } //for
- else if (readString.indexOf("me") > 0) // menu rec
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF58A7, 32);
- Serial.println("menu");
- lcd.setCursor(0, 1);
- lcd.print(" Menu ");
- }
- } //for
- else if (readString.indexOf("favorito") > 0) // favorito
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFEA15, 32);
- Serial.println("favorito");
- lcd.setCursor(0, 1);
- lcd.print(" Favorito ");
- } //for
- }
- else if (readString.indexOf("radio") > 0) // radio
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF2CD3, 32);
- Serial.println("radio");
- lcd.setCursor(0, 1);
- lcd.print(" Radio ");
- } //for
- }
- else if (readString.indexOf("in") > 0) // informacao
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF56A9, 32);
- Serial.println("informacao");
- lcd.setCursor(0, 1);
- lcd.print(" Informacao ");
- } //for
- }
- else if (readString.indexOf("ce") > 0) // CENA TV
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF50AF, 32);
- delay(2000);
- //ligar tv
- irsend.sendNEC(0x2FD48B7, 32);
- Serial.println("tv receptor");
- lcd.setCursor(0, 1);
- lcd.print(" Cena TV ");
- } //for
- }
- else if (readString.indexOf("c1") > 0) // 1
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF807F, 32);
- Serial.println("1");
- lcd.setCursor(0, 1);
- lcd.print(" 1 ");
- } //for
- }
- else if (readString.indexOf("c2") > 0) //2
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF40BF, 32);
- Serial.println("2");
- lcd.setCursor(0, 1);
- lcd.print(" 2 ");
- } //for
- }
- else if (readString.indexOf("c3") > 0) // 3
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFC03F, 32);
- Serial.println("3");
- lcd.setCursor(0, 1);
- lcd.print("");
- } //for
- }
- else if (readString.indexOf("c4") > 0) // 4
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF20DF, 32);
- Serial.println("4");
- lcd.setCursor(0, 1);
- lcd.print(" 4 ");
- } //for
- }
- else if (readString.indexOf("c5") > 0) // 5
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFA05F, 32);
- Serial.println("5");
- lcd.setCursor(0, 1);
- lcd.print(" 5 ");
- } //for
- }
- else if (readString.indexOf("c6") > 0) // 6
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF609F, 32);
- Serial.println("6");
- lcd.setCursor(0, 1);
- lcd.print(" 6 ");
- } //for
- }
- else if (readString.indexOf("c7") > 0) //7
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFE01F, 32);
- Serial.println("7");
- lcd.setCursor(0, 1);
- lcd.print(" 7 ");
- } //for
- }
- else if (readString.indexOf("c8") > 0) // 8
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC (0xFF10EF, 32);
- Serial.println("8");
- lcd.setCursor(0, 1);
- lcd.print(" 8 ");
- } //for
- }
- else if (readString.indexOf("c9") > 0) //9
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF906F, 32);
- Serial.println("9");
- lcd.setCursor(0, 1);
- lcd.print(" 9 ");
- } //for
- }
- else if (readString.indexOf("c0") > 0) // 0
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF00FF, 32);
- Serial.println("0");
- lcd.setCursor(0, 1);
- lcd.print(" 0 ");
- } //for
- }
- //// TELEVISAO
- else if (readString.indexOf("tv") > 0) // tv
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD48B7, 32);
- Serial.println("tv");
- lcd.setCursor(0, 1);
- lcd.print(" Televisao ");
- } //for
- }
- else if (readString.indexOf("put") > 0) // input
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FDF00F, 32);
- Serial.println("input");
- lcd.setCursor(0, 1);
- lcd.print(" Input ");
- } //for
- }
- else if (readString.indexOf("mt") > 0) // menu
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD01FE, 32);
- Serial.println("menutv");
- lcd.setCursor(0, 1);
- lcd.print(" Menu TV ");
- } //for
- }
- else if (readString.indexOf("up") > 0) // setacima
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD41BE, 32);
- Serial.println("cima");
- lcd.setCursor(0, 1);
- lcd.print(" Cima ");
- } //for
- }
- else if (readString.indexOf("down") > 0) // seta baixo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FDC13E, 32);
- Serial.println("baixo");
- lcd.setCursor(0, 1);
- lcd.print(" Baixo ");
- } //for
- }
- else if (readString.indexOf("le") > 0) // lado esquerdo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FDB847, 32);
- Serial.println("esquerda");
- lcd.setCursor(0, 1);
- lcd.print(" Esquerda ");
- } //for
- }
- else if (readString.indexOf("ld") > 0) // lado direito
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD9867, 32);
- Serial.println("direita");
- lcd.setCursor(0, 1);
- lcd.print(" Direita ");
- } //for
- }
- else if (readString.indexOf("vol+") > 0) // volume+
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD58A7, 32);
- Serial.println("vol");
- lcd.setCursor(0, 1);
- lcd.print(" Volume + ");
- } //for
- }
- else if (readString.indexOf("vol-") > 0) // volume -
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD7887, 32);
- Serial.println("vol");
- lcd.setCursor(0, 1);
- lcd.print(" Volume - ");
- } //for
- }
- else if (readString.indexOf("vot") > 0) // Voltar
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FF00FF, 32);
- Serial.println("voltar");
- lcd.setCursor(0, 1);
- lcd.print(" Voltar ");
- } //for
- }
- else if (readString.indexOf("mudo") > 0) // mudo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD08F7, 32);
- Serial.println("mute");
- lcd.setCursor(0, 1);
- lcd.print(" Mudo ");
- } //for
- }
- else if (readString.indexOf("temp") > 0) // sleep
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FDA857, 32);
- Serial.println("Sleep");
- lcd.setCursor(0, 1);
- lcd.print(" Sleep ");
- } //for
- }
- else if (readString.indexOf("flix") > 0) // netflix
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD54AB, 32);
- Serial.println("netfix");
- lcd.setCursor(0, 1);
- lcd.print(" Netflix ");
- } //for
- }
- else if (readString.indexOf("at") > 0) // enter
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD916E, 32);
- Serial.println("enter");
- lcd.setCursor(0, 1);
- lcd.print(" Enter ");
- } //for
- }
- else if (readString.indexOf("w") > 0) // internet
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD5BA4, 32);
- Serial.println("internet");
- lcd.setCursor(0, 1);
- lcd.print(" Internet ");
- } //for
- }
- ////Controle HOme
- else if (readString.indexOf("ho") > 0) // home
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_pwr, 67, 38);
- Serial.println("home");
- lcd.setCursor(0, 1);
- lcd.print(" Home Theather ");
- } //for
- }
- else if (readString.indexOf("fun") > 0) // funcao
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_fca, 67, 38);
- Serial.println("funcao");
- lcd.setCursor(0, 1);
- lcd.print(" Funcao ");
- } //for
- }
- else if (readString.indexOf("bai") > 0) // vol baixo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_vol, 67, 38);
- Serial.println("vol");
- lcd.setCursor(0, 1);
- lcd.print(" Volume - ");
- } //for
- }
- else if (readString.indexOf("alt") > 0) // vol alto
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_volm, 67, 38);
- Serial.println("vol");
- lcd.setCursor(0, 1);
- lcd.print(" Volume + ");
- } //for
- }
- else if (readString.indexOf("an") > 0) // anterior
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_ant, 67, 38);
- Serial.println("ant");
- lcd.setCursor(0, 1);
- lcd.print(" anterior ");
- } //for
- }
- else if (readString.indexOf("ava") > 0) // avancar
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_ava, 67, 38);
- Serial.println("avan");
- lcd.setCursor(0, 1);
- lcd.print(" avancar ");
- } //for
- }
- else if (readString.indexOf("play") > 0) // play
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_pla, 67, 38);
- Serial.println("play");
- lcd.setCursor(0, 1);
- lcd.print(" Play ");
- } //for
- }
- else if (readString.indexOf("cim") > 0) // cima
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_cim, 67, 38);
- Serial.println("cima");
- lcd.setCursor(0, 1);
- lcd.print(" Cima ");
- } //for
- }
- else if (readString.indexOf("pba") > 0) // avancar
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(S_bai, 67, 38);
- Serial.println("baixo");
- lcd.setCursor(0, 1);
- lcd.print(" Baixo ");
- } //for
- }
- /// AR CONDICIONADO
- else if (readString.indexOf("arl") > 0) // ar Liga
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(lig_ar, 59, 38);
- Serial.println("ar");
- lcd.setCursor(0, 1);
- lcd.print(" Ar Ligado ");
- } //for
- }
- else if (readString.indexOf("ard") > 0) // ar desliga
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(des_ar, 59, 38);
- Serial.println("ar");
- lcd.setCursor(0, 1);
- lcd.print(" AR Desligado ");
- } //for
- }
- else if (readString.indexOf("modo") > 0) // modo
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(modo_ar, 59, 38);
- Serial.println("modo");
- lcd.setCursor(0, 1);
- lcd.print(" Modo ");
- } //for
- }
- else if (readString.indexOf("velo") > 0) //velocidade
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(velocidade_ar, 61, 38);
- Serial.println("velocidade");
- lcd.setCursor(0, 1);
- lcd.print(" Velocidade ");
- } //for
- }
- else if (readString.indexOf("ar+") > 0) // ar +
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(aumenta_ar, 59, 38);
- Serial.println("ar+");
- lcd.setCursor(0, 1);
- lcd.print(" Ar + ");
- } //for
- }
- else if (readString.indexOf("ar-") > 0) // ar -
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendRaw(diminui_ar, 59, 38);
- Serial.println("ar-");
- lcd.setCursor(0, 1);
- lcd.print(" Ar - ");
- } //for
- }
- ///FITA DE LED
- else if (readString.indexOf("fil") > 0) // led
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF02FD, 32);
- Serial.println("led");
- lcd.setCursor(0, 1);
- lcd.print(" Fita de Led ");
- } //for
- }
- else if (readString.indexOf("+b") > 0) //mais brilho
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF3AC5, 32);
- Serial.println("brilho");
- lcd.setCursor(0, 1);
- lcd.print(" Brilho +");
- } //for
- }
- else if (readString.indexOf("-b") > 0) // menos brilho
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFBA45, 32);
- Serial.println("brilho");
- lcd.setCursor(0, 1);
- lcd.print(" Brilho - ");
- } //for
- }
- else if (readString.indexOf("bra") > 0) //branco
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF22DD, 32);
- Serial.println("branco");
- lcd.setCursor(0, 1);
- lcd.print(" Branco ");
- } //for
- }
- else if (readString.indexOf("red") > 0) // vermelho
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFA25D, 32);
- Serial.println("verde");
- lcd.setCursor(0, 1);
- lcd.print(" Verde ");
- } //for
- }
- else if (readString.indexOf("azul") > 0) //azul
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF1AE5, 32);
- Serial.println("azul");
- lcd.setCursor(0, 1);
- lcd.print(" Azul ");
- } //for
- }
- else if (readString.indexOf("green") > 0) // verde
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF9A65, 32);
- Serial.println("ver");
- lcd.setCursor(0, 1);
- lcd.print(" Vermelho ");
- } //for
- }
- else if (readString.indexOf("fla") > 0) // flash
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFD02F, 32);
- Serial.println("flash");
- lcd.setCursor(0, 1);
- lcd.print(" Flash ");
- } //for
- }
- else if (readString.indexOf("ef1") > 0) // efeito1
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF20DF, 32);
- Serial.println("E1");
- lcd.setCursor(0, 1);
- lcd.print(" Efeito 1 ");
- } //for
- }
- else if (readString.indexOf("ef2") > 0) // efeito2
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFA05F, 32);
- Serial.println("E2");
- lcd.setCursor(0, 1);
- lcd.print(" Efeito 2 ");
- } //for
- }
- else if (readString.indexOf("ef3") > 0) // efeito3
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFF609F, 32);
- Serial.println("E3");
- lcd.setCursor(0, 1);
- lcd.print(" Efeito 3 ");
- } //for
- }
- else if (readString.indexOf("ef4") > 0) // efeito4
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFE01F, 32);
- Serial.println("E4");
- lcd.setCursor(0, 1);
- lcd.print(" Efeito 4 ");
- } //for
- }
- else if (readString.indexOf("so") > 0) //slow
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFC837, 32);
- Serial.println("Slow");
- lcd.setCursor(0, 1);
- lcd.print(" Slow ");
- } //for
- }
- else if (readString.indexOf("qu") > 0) //Quick
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0xFFE817, 32);
- Serial.println("Quick");
- lcd.setCursor(0, 1);
- lcd.print(" Quick ");
- } //for
- }
- /////////////////
- else if (readString.indexOf("st") > 0) // sair TV
- {
- for (int i = 0; i < 1; i++) {
- irsend.sendNEC(0x2FD1AE5, 32);
- Serial.println("sairtv");
- lcd.setCursor(0, 1);
- lcd.print(" Sair Tv ");
- } //for
- }
- readString = "";
- //Cabeçalho padrão para aparecer a página web
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println();
- client.println("<html>");
- client.println(F("<!doctype html>"));
- //Esta parte será mostrada no navegador.
- 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\">AUTOMATIZANDO</font>"));
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"blue\"> QUARTO do Lucas</font><br />"));
- client.println(F("</center>"));
- ///REles
- client.println(F("<font size=\"3\" face=\"verdana\" color=\"blue\">LAMPADAS</font>"));
- 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=\"/bide\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On-Off Banheiro</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/escada\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On-Off Escada</button> "));
- client.println(F("</form> <br />"));
- //////RECEPTOR
- client.println(F("<font size=\"3\" face=\"verdana\" color=\"blue\">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=\"/ce\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cena - TV </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ex\" 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=\"/me\" 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=\"/in\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Informacao</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ne\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Internet</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/radio\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Radio</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c1\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">1</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c2\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">2</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c3\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">3</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c4\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">4</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c5\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">5</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c6\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">6</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c7\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">7</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c8\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">8</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c9\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">9</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/c0\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">0</button> "));
- client.println(F("</form> <br />"));
- //TELEVISAO
- client.println(F("<font size=\"3\" face=\"verdana\" color=\"blue\">TELEVISAO</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=\"/put\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Input</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/up\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Cima </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/down\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Baixo</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/le\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Esquerda </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ld\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Direita </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/vol+\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/vol-\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
- client.println(F("</form> <br />"));;
- client.println(F("<form action=\"/st\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Exit TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/vot\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Voltar</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/mudo\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Mudo</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/zo\" 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=\"/flix\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Netflix</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/mt\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Menu TV</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/w\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Internet TV</button> "));
- client.println(F("</form> <br />"));
- /// HOME TEATHER
- client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Home</font>"));
- client.println(F("<form action=\"/ho\" 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=\"/fun\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Função</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/bai\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/alt\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/an\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Anterior</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ava\" 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=\"/cim\" 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=\"/pba\" 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=\"/arl\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On Ar</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ard\" 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=\"/velo\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Velocidade</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ar-\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Ar -</button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ar+\" 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=\"/fil\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">On Off Led </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/+b\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Aumenta </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/-b\" 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=\"/red\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Vermelho </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/green\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Verde </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/bra\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Branco </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/fla\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Flash </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ef1\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 1 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ef2\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 2 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ef3\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 3 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/ef4\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Efeito 4 </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/so\" method=\"get\">"));
- client.println(F("<button type=submit style=\"width:200px;\">Slow </button> "));
- client.println(F("</form> <br />"));
- client.println(F("<form action=\"/qu\" 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("</body>");
- client.println("</html>");
- //Dar um tempo para o navegador receber as informações
- delay(1);
- //Fechar a conexão com o servidor
- client.stop();
- } // if (c =='n')
- } // if (client.available())
- } // while (client.connected())
- } // if (client)
- } // Loop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement