Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.33 KB | None | 0 0
  1. /*PROJETO AUTOMAÇÃO 1.6 (QUARTO)
  2. Ajuda a desenvolver e dicas no codigo
  3. Rui Viana lab de garagem , Marcos Lab de garabem e
  4. Romario de Jesus Santana lab de garagem
  5. sinceros agradecimentos a todos
  6. 2018 atualizado*/
  7.  
  8.  
  9. //CONTROLE REMOTO
  10. #include <IRremote.h>
  11. #include <SPI.h>
  12. #include <Ethernet.h> //W5100
  13. #include <LiquidCrystal.h>
  14. #include <String.h>
  15. #define RECV_PIN 2
  16. IRsend irsend;
  17. //define receptor IR
  18. IRrecv irrecv(RECV_PIN);
  19. decode_results results;
  20. LiquidCrystal lcd(22,24,26,28,30,32);
  21.  
  22. bool rele4=true, rele5=true, rele6=true ;//variaveis para estado do rele
  23.  
  24. byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
  25. IPAddress ip(192, 168, 15, 177);
  26.  
  27. EthernetServer server(80);
  28.  
  29. //RELES
  30.  
  31.  
  32. int pino_rele4 = 7 ; // Luz Quarto
  33. int pino_rele6 = 6;// Luz da escada
  34. int pino_rele5 = 5; // Luz do banheiro
  35. int sensorquarto = A0; //Pino analógico em que o sensor LDR está conectado.
  36. int valorSensorquarto = 0; //Usada para ler o valor do sensor em tempo real
  37. 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,};
  38. 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,};
  39. 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,};
  40. 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,};
  41. 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,};
  42. 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,};
  43. 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,};
  44. 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,};
  45. unsigned int S_bai[67] = {4500, 4400, 600, 1600, 650, 1600, 600, 500, 650, 450, 650, 450, 650, 500, 600, 1600, 600, 500, 650, 1600, 600, 1600, 600, 500, 600, 500, 600, 1650, 600, 500, 600, 1600, 600, 500, 650, 1600, 650, 450, 650, 1550, 650, 500, 600, 1600, 600, 500, 650, 450, 650, 500, 600, 500, 600, 1600, 650, 450, 650, 1600, 600, 500, 600, 1600, 650, 1600, 600, 1600, 600,};
  46. /// ar condicionado
  47. 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,};
  48. 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,};
  49. 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,};
  50. 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,};
  51. 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,};
  52. unsigned int lig_ar[59] = {3188, 9684, 604, 1464, 612, 436, 584, 436, 584, 436, 580, 1468, 600, 420, 600, 420, 600, 420, 576, 468, 576, 444, 560, 460, 504, 520, 576, 468, 552, 468, 556, 464, 584, 436, 528, 492, 580, 1468, 576, 1464, 576, 444, 576, 468, 556, 1484, 584, 436, 584, 436, 564, 1480, 556, 464, 556, 1492, 572, 468, 552,};
  53.  
  54. void setup() {
  55. pinMode(pino_rele4, OUTPUT); // Quarto
  56. pinMode(pino_rele5, OUTPUT); // banheiro
  57. pinMode(pino_rele6, OUTPUT); // escada
  58. //Desliga os reles
  59. digitalWrite(pino_rele4, HIGH); // Quarto
  60. digitalWrite(pino_rele5, HIGH); // banheiro
  61. digitalWrite(pino_rele6, HIGH); // escada
  62. Ethernet.begin(mac, ip);
  63. Serial.begin(9600);
  64. server.begin();
  65. Serial.println();
  66. //Controle remoto mega pin 9
  67. pinMode(9, OUTPUT);
  68. digitalWrite(9, LOW);
  69. irrecv.enableIRIn();
  70. lcd.begin(16, 2); //Inicia o LCD com dimensões 16x2(Colunas x Linhas)
  71. lcd.print("Automacao Luckas");
  72. lcd.setCursor(0,1);
  73.  
  74. }
  75.  
  76. void loop() {
  77. {
  78. ////sensor quarto/////
  79. if (valorSensorquarto>= 1000);{
  80. Serial.println("Ligado");
  81. Serial.print ("Luz Quarto Desligado");
  82. }
  83.  
  84.  
  85. if (valorSensorquarto< 970)
  86. {
  87. Serial.println("Ligado");
  88. Serial.print ("Luz Quarto Ligada");
  89.  
  90. int valorSensorquarto = analogRead(sensorquarto);
  91. Serial.println(valorSensorquarto);
  92. delay(1000);
  93. }
  94.  
  95.  
  96. EthernetClient client = server.available();
  97. if (client) {
  98. String vars;
  99.  
  100. byte acao = 0;
  101. boolean currentLineIsBlank = true;
  102. while (client.connected()) {
  103. if (client.available()) {
  104. char c = client.read();
  105.  
  106. vars.concat(c);
  107. //Página Html//
  108. if (c == '\n') {
  109. client.println(F("HTTP/1.1 200 OK"));
  110. client.println(F("Content-Type: text/html"));
  111. client.println();
  112. client.println(F("<!doctype html>"));
  113. client.println(F("<head>"));
  114. client.println(F("<meta charset=\"utf-8\">"));
  115. client.println(F("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\""));
  116. client.println(F("<title>Automação meu QUARTO</title>"));
  117. client.println(F("<meta name=\"viewport\" content=\"width=320\">"));
  118. client.println(F("<meta name=\"viewport\" content=\"width=device-width\">"));
  119. client.println(F("<meta charset=\"utf-8\">"));
  120. client.println(F("<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">"));
  121. client.println(F("</head>"));
  122. client.println(F("<body>"));
  123. client.println(F("<center>"));
  124. client.println(F("<meta charset=\"utf-8\">"));
  125. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">AUTOMATIZANDO</font>"));
  126. client.println(F("<font size=\"5\" face=\"verdana\" color=\"blue\"> QUARTO do Lucas</font><br />"));
  127. client.println(F("</center>"));
  128. client.println(" </div>");
  129. ///REles ////////
  130.  
  131. client.println("<div style='position:absolute;margin-left:1px;margin-top:10px;width:600px;height:140px;z-index:1'>");
  132.  
  133. client.println("<a href=?sala><button style= width:200px;height:50px; ’border-height: 1px solid #ff0000; border-left: 1px solid #ff0000′ type=’button’>Quarto</button></a>");
  134.  
  135. if(valorSensorquarto< 970)
  136. {
  137. client.println("<button style= width:100px;height:50px; ’border-height: 1px solid #006400; border-left: 1px solid #006400′ type=’button’>Quarto LIGADO</button>");
  138. }
  139. else if (valorSensorquarto>= 1000)
  140. {
  141. client.println("<button style= width:100px;height:50px; ’border-height: 1px solid #FF4040; border-left: 1px solid #FF4040′ type=’button’>Quarto DESLIGADO</button>");
  142.  
  143. client.println(" </div>");
  144. }
  145. ///////////////////////////////////////
  146. client.println(F("<form action=\"/quarto\" method=\"get\">"));
  147. client.println(F("<button type=submit style=\"width:200px;\">Quarto -</button> "));
  148. client.println(F("</form> <br />"));
  149. ///banheiro
  150. client.println(F("<form action=\"/banheiro\" method=\"get\">"));
  151. client.println(F("<button type=submit style=\"width:200px;\">On-Off Banheiro</button> "));
  152. client.println(F("</form> <br />"));
  153. ///escada
  154. client.println(F("<form action=\"/escada\" method=\"get\">"));
  155. client.println(F("<button type=submit style=\"width:200px;\">On-Off Escada</button> "));
  156. client.println(F("</form> <br />"));
  157. //// receptor
  158. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Receptor</font>"));
  159. client.println(F("<form action=\"/receptor\" method=\"get\">"));
  160. client.println(F("<button type=submit style=\"width:200px;\">On Off Receptor</button> "));
  161. client.println(F("</form> <br />"));
  162. client.println(F("<form action=\"/cima\" method=\"get\">"));
  163. client.println(F("<button type=submit style=\"width:200px;\">Cima </button> "));
  164. client.println(F("</form> <br />"));
  165. client.println(F("<form action=\"/setadireita\" method=\"get\">"));
  166. client.println(F("<button type=submit style=\"width:200px;\">Direita </button> "));
  167. client.println(F("</form> <br />"));
  168. client.println(F("<form action=\"/setaesquerda\" method=\"get\">"));
  169. client.println(F("<button type=submit style=\"width:200px;\">Esquerda </button> "));
  170. client.println(F("</form> <br />"));
  171. client.println(F("<form action=\"/ok\" method=\"get\">"));
  172. client.println(F("<button type=submit style=\"width:200px;\">oK </button> "));
  173. client.println(F("</form> <br />"));
  174. client.println(F("<form action=\"/baixo\" method=\"get\">"));
  175. client.println(F("<button type=submit style=\"width:200px;\">Baixo </button> "));
  176. client.println(F("</form> <br />"));
  177. client.println(F("<form action=\"/cenatv\" method=\"get\">"));
  178. client.println(F("<button type=submit style=\"width:200px;\">Cena - TV </button> "));
  179. client.println(F("</form> <br />"));
  180. client.println(F("<form action=\"/exitre\" method=\"get\">"));
  181. client.println(F("<button type=submit style=\"width:200px;\">Exit</button> "));
  182. client.println(F("</form> <br />"));
  183. client.println(F("<form action=\"/sleep\" method=\"get\">"));
  184. client.println(F("<button type=submit style=\"width:200px;\">Temporizador</button> "));
  185. client.println(F("</form> <br />"));
  186. client.println(F("<form action=\"/recmenu\" method=\"get\">"));
  187. client.println(F("<button type=submit style=\"width:200px;\">Menu</button> "));
  188. client.println(F("</form> <br />"));
  189. client.println(F("<form action=\"/+10\" method=\"get\">"));
  190. client.println(F("<button type=submit style=\"width:200px;\">+10</button> "));
  191. client.println(F("</form> <br />"));
  192. client.println(F("<form action=\"/-10\" method=\"get\">"));
  193. client.println(F("<button type=submit style=\"width:200px;\">-10</button> "));
  194. client.println(F("</form> <br />"));
  195. client.println(F("<form action=\"/canal1\" method=\"get\">"));
  196. client.println(F("<button type=submit style=\"width:200px;\">1</button> "));
  197. client.println(F("</form> <br />"));
  198. client.println(F("<form action=\"/2\" method=\"get\">"));
  199. client.println(F("<button type=submit style=\"width:200px;\">2</button> "));
  200. client.println(F("</form> <br />"));
  201. client.println(F("<form action=\"/3\" method=\"get\">"));
  202. client.println(F("<button type=submit style=\"width:200px;\">3</button> "));
  203. client.println(F("</form> <br />"));
  204. client.println(F("<form action=\"/4\" method=\"get\">"));
  205. client.println(F("<button type=submit style=\"width:200px;\">4</button> "));
  206. client.println(F("</form> <br />"));
  207. client.println(F("<form action=\"/5\" method=\"get\">"));
  208. client.println(F("<button type=submit style=\"width:200px;\">5</button> "));
  209. client.println(F("</form> <br />"));
  210. client.println(F("<form action=\"/6\" method=\"get\">"));
  211. client.println(F("<button type=submit style=\"width:200px;\">6</button> "));
  212. client.println(F("</form> <br />"));
  213. client.println(F("<form action=\"/7\" method=\"get\">"));
  214. client.println(F("<button type=submit style=\"width:200px;\">7</button> "));
  215. client.println(F("</form> <br />"));
  216. client.println(F("<form action=\"/8\" method=\"get\">"));
  217. client.println(F("<button type=submit style=\"width:200px;\">8</button> "));
  218. client.println(F("</form> <br />"));
  219. client.println(F("<form action=\"/9\" method=\"get\">"));
  220. client.println(F("<button type=submit style=\"width:200px;\">9</button> "));
  221. client.println(F("</form> <br />"));
  222. client.println(F("<form action=\"/0\" method=\"get\">"));
  223. client.println(F("<button type=submit style=\"width:200px;\">0</button> "));
  224. client.println(F("</form> <br />"));
  225. client.println(F("<form action=\"/info\" method=\"get\">"));
  226. client.println(F("<button type=submit style=\"width:200px;\">Informacao</button> "));
  227. client.println(F("</form> <br />"));
  228. client.println(F("<form action=\"/radio\" method=\"get\">"));
  229. client.println(F("<button type=submit style=\"width:200px;\">Radio</button> "));
  230. client.println(F("</form> <br />"));
  231. client.println(F("<form action=\"/mutrec\" method=\"get\">"));
  232. client.println(F("<button type=submit style=\"width:200px;\">Mudo</button> "));
  233. client.println(F("</form> <br />"));
  234. ////controletv
  235. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Tv</font>"));
  236. client.println(F("<form action=\"/tv\" method=\"get\">"));
  237. client.println(F("<button type=submit style=\"width:200px;\">On-Off TV</button> "));
  238. client.println(F("</form> <br />"));
  239. client.println(F("<form action=\"/input\" method=\"get\">"));
  240. client.println(F("<button type=submit style=\"width:200px;\">Input</button> "));
  241. client.println(F("</form> <br />"));
  242. client.println(F("<form action=\"/setacima\" method=\"get\">"));
  243. client.println(F("<button type=submit style=\"width:200px;\">Cima </button> "));
  244. client.println(F("</form> <br />"));
  245. client.println(F("<form action=\"/setabaixo\" method=\"get\">"));
  246. client.println(F("<button type=submit style=\"width:200px;\">Baixo</button> "));
  247. client.println(F("</form> <br />"));
  248. client.println(F("<form action=\"/esquerdatv\" method=\"get\">"));
  249. client.println(F("<button type=submit style=\"width:200px;\">Esquerda </button> "));
  250. client.println(F("</form> <br />"));
  251. client.println(F("<form action=\"/direitatv\" method=\"get\">"));
  252. client.println(F("<button type=submit style=\"width:200px;\">Direita </button> "));
  253. client.println(F("</form> <br />"));
  254. client.println(F("<form action=\"/volume+\" method=\"get\">"));
  255. client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
  256. client.println(F("</form> <br />"));
  257. client.println(F("<form action=\"/volume-\" method=\"get\">"));
  258. client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
  259. client.println(F("</form> <br />"));;
  260. client.println(F("<form action=\"/exittv\" method=\"get\">"));
  261. client.println(F("<button type=submit style=\"width:200px;\">Exit TV</button> "));
  262. client.println(F("</form> <br />"));
  263. client.println(F("<form action=\"/voltar\" method=\"get\">"));
  264. client.println(F("<button type=submit style=\"width:200px;\">Voltar</button> "));
  265. client.println(F("</form> <br />"));
  266. client.println(F("<form action=\"/mutetv\" method=\"get\">"));
  267. client.println(F("<button type=submit style=\"width:200px;\">Mudo</button> "));
  268. client.println(F("</form> <br />"));
  269. client.println(F("<form action=\"/enter\" method=\"get\">"));
  270. client.println(F("<button type=submit style=\"width:200px;\">Enter</button> "));
  271. client.println(F("</form> <br />"));
  272. client.println(F("<form action=\"/temp\" method=\"get\">"));
  273. client.println(F("<button type=submit style=\"width:200px;\">Temporizar TV</button> "));
  274. client.println(F("</form> <br />"));
  275. client.println(F("<form action=\"/netflix\" method=\"get\">"));
  276. client.println(F("<button type=submit style=\"width:200px;\">Netflix</button> "));
  277. client.println(F("</form> <br />"));
  278. client.println(F("<form action=\"/menutv\" method=\"get\">"));
  279. client.println(F("<button type=submit style=\"width:200px;\">Menu TV</button> "));
  280. client.println(F("</form> <br />"));
  281. client.println(F("<form action=\"/internet\" method=\"get\">"));
  282. client.println(F("<button type=submit style=\"width:200px;\">Internet TV</button> "));
  283. client.println(F("</form> <br />"));
  284. /// CONTROLE HOME
  285. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Home</font>"));
  286. client.println(F("<form action=\"/home\" method=\"get\">"));
  287. client.println(F("<button type=submit style=\"width:200px;\">On Off Home</button> "));
  288. client.println(F("</form> <br />"));
  289. client.println(F("<form action=\"/funcao\" method=\"get\">"));
  290. client.println(F("<button type=submit style=\"width:200px;\">Função</button> "));
  291. client.println(F("</form> <br />"));
  292. client.println(F("<form action=\"/volmenoshome\" method=\"get\">"));
  293. client.println(F("<button type=submit style=\"width:200px;\">Vol -</button> "));
  294. client.println(F("</form> <br />"));
  295. client.println(F("<form action=\"/volmaishome\" method=\"get\">"));
  296. client.println(F("<button type=submit style=\"width:200px;\">Vol +</button> "));
  297. client.println(F("</form> <br />"));
  298. client.println(F("<form action=\"/anterior\" method=\"get\">"));
  299. client.println(F("<button type=submit style=\"width:200px;\">Anterior</button> "));
  300. client.println(F("</form> <br />"));
  301. client.println(F("<form action=\"/avancar\" method=\"get\">"));
  302. client.println(F("<button type=submit style=\"width:200px;\">Avançar TV</button> "));
  303. client.println(F("</form> <br />"));
  304. client.println(F("<form action=\"/play\" method=\"get\">"));
  305. client.println(F("<button type=submit style=\"width:200px;\">Play</button> "));
  306. client.println(F("</form> <br />"));
  307. client.println(F("<form action=\"/btncim\" method=\"get\">"));
  308. client.println(F("<button type=submit style=\"width:200px;\">Cima</button> "));
  309. client.println(F("</form> <br />"));
  310. /// apartir daqui nao funciona comando
  311. client.println(F("<form action=\"/btnbai\" method=\"get\">"));
  312. client.println(F("<button type=submit style=\"width:200px;\">Baixo</button> "));
  313. client.println(F("</form> <br />"));
  314. ///Controle ar Condicionado
  315. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Controle Ar Condicionado</font>"));
  316. client.println(F("<form action=\"/ligarar\" method=\"get\">"));
  317. client.println(F("<button type=submit style=\"width:200px;\">On Ar</button> "));
  318. client.println(F("</form> <br />"));
  319. client.println(F("<form action=\"/desliga_ar\" method=\"get\">"));
  320. client.println(F("<button type=submit style=\"width:200px;\">Off Ar </button> "));
  321. client.println(F("</form> <br />"));
  322. client.println(F("<form action=\"/modo\" method=\"get\">"));
  323. client.println(F("<button type=submit style=\"width:200px;\">Modo</button> "));
  324. client.println(F("</form> <br />"));
  325. client.println(F("<form action=\"/velocidade\" method=\"get\">"));
  326. client.println(F("<button type=submit style=\"width:200px;\">Velocidade</button> "));
  327. client.println(F("</form> <br />"));
  328. client.println(F("<form action=\"/menosar\" method=\"get\">"));
  329. client.println(F("<button type=submit style=\"width:200px;\">Ar -</button> "));
  330. client.println(F("</form> <br />"));
  331. client.println(F("<form action=\"/maisar\" method=\"get\">"));
  332. client.println(F("<button type=submit style=\"width:200px;\">Ar + </button> "));
  333. client.println(F("</form> <br />"));
  334. ///fita de led
  335. client.println(F("<font size=\"5\" face=\"verdana\" color=\"green\">Fita de Led</font>"));
  336. client.println(F("<form action=\"/led\" method=\"get\">"));
  337. client.println(F("<button type=submit style=\"width:200px;\">On Off Led </button> "));
  338. client.println(F("</form> <br />"));
  339. client.println(F("<form action=\"/aumenta\" method=\"get\">"));
  340. client.println(F("<button type=submit style=\"width:200px;\">Aumenta </button> "));
  341. client.println(F("</form> <br />"));
  342. client.println(F("<form action=\"/diminui\" method=\"get\">"));
  343. client.println(F("<button type=submit style=\"width:200px;\">Diminui </button> "));
  344. client.println(F("</form> <br />"));
  345. client.println(F("<form action=\"/azul\" method=\"get\">"));
  346. client.println(F("<button type=submit style=\"width:200px;\">Azul </button> "));
  347. client.println(F("</form> <br />"));
  348. client.println(F("<form action=\"/vermelho\" method=\"get\">"));
  349. client.println(F("<button type=submit style=\"width:200px;\">Vermelho </button> "));
  350. client.println(F("</form> <br />"));
  351. client.println(F("<form action=\"/verde\" method=\"get\">"));
  352. client.println(F("<button type=submit style=\"width:200px;\">Verde </button> "));
  353. client.println(F("</form> <br />"));
  354. client.println(F("<form action=\"/branco\" method=\"get\">"));
  355. client.println(F("<button type=submit style=\"width:200px;\">Branco </button> "));
  356. client.println(F("</form> <br />"));
  357. client.println(F("<form action=\"/flash\" method=\"get\">"));
  358. client.println(F("<button type=submit style=\"width:200px;\">Flash </button> "));
  359. client.println(F("</form> <br />"));
  360. client.println(F("<form action=\"/efei1\" method=\"get\">"));
  361. client.println(F("<button type=submit style=\"width:200px;\">Efeito 1 </button> "));
  362. client.println(F("</form> <br />"));
  363. client.println(F("<form action=\"/efei2\" method=\"get\">"));
  364. client.println(F("<button type=submit style=\"width:200px;\">Efeito 2 </button> "));
  365. client.println(F("</form> <br />"));
  366. client.println(F("<form action=\"/efei3\" method=\"get\">"));
  367. client.println(F("<button type=submit style=\"width:200px;\">Efeito 3 </button> "));
  368. client.println(F("</form> <br />"));
  369. client.println(F("<form action=\"/efei4\" method=\"get\">"));
  370. client.println(F("<button type=submit style=\"width:200px;\">Efeito 4 </button> "));
  371. client.println(F("</form> <br />"));
  372. client.println(F("<form action=\"/slow\" method=\"get\">"));
  373. client.println(F("<button type=submit style=\"width:200px;\">Slow </button> "));
  374. client.println(F("</form> <br />"));
  375. client.println(F("<form action=\"/quick\" method=\"get\">"));
  376. client.println(F("<button type=submit style=\"width:200px;\">Quick</button> "));
  377. client.println(F("</form> <br />"));
  378. client.println(F(""));
  379. client.println(F("</center>"));
  380. client.println(F("</body>"));
  381. client.println(F("</html>"));
  382. break;
  383. }//final if \n
  384. }//final client.avaliable
  385.  
  386. //AQUI ACONTECEM AS COMPARACOES(Receptor)
  387. /// if (vars.endsWith(F("/ligarec"))) acao = 2;
  388. if (vars.endsWith(F("/cenatv"))) acao = 3;
  389. else if (vars.endsWith(F("/ok"))) acao = 4;
  390. else if (vars.endsWith(F("/setadireita"))) acao = 5;
  391. else if (vars.endsWith(F("/setaesquerda"))) acao = 6;
  392. else if (vars.endsWith(F("/cima"))) acao = 7;
  393. else if (vars.endsWith(F("/baixo"))) acao = 8;
  394. else if (vars.endsWith(F("/exitre"))) acao = 9;
  395. else if (vars.endsWith(F("/sleep"))) acao=10;
  396. else if (vars.endsWith(F("/recmenu"))) acao=11;
  397. else if (vars.endsWith(F("/+10"))) acao=12;
  398. else if (vars.endsWith(F("/canal1"))) acao=13;
  399. else if (vars.endsWith(F("/2"))) acao=14;
  400. else if (vars.endsWith(F("/3"))) acao=15;
  401. else if (vars.endsWith(F("/4"))) acao=16;
  402. else if (vars.endsWith(F("/5"))) acao=17;
  403. else if (vars.endsWith(F("/6"))) acao=18;
  404. else if (vars.endsWith(F("/7"))) acao=19;
  405. else if (vars.endsWith(F("/8"))) acao = 20;
  406. else if (vars.endsWith(F("/9"))) acao = 21;
  407. else if (vars.endsWith(F("/0"))) acao = 22;
  408. else if (vars.endsWith(F("/receptor"))) acao = 55;
  409. else if (vars.endsWith(F("/info"))) acao = 71;
  410. else if (vars.endsWith(F("/radio"))) acao = 73;
  411. else if (vars.endsWith(F("/mutrec"))) acao = 74;
  412. else if (vars.endsWith(F("/-10"))) acao=75;
  413.  
  414. /// Rele
  415. else if (vars.endsWith(F("/quarto"))) acao = 23;
  416. else if (vars.endsWith(F("/banheiro"))) acao = 24;
  417. else if (vars.endsWith(F("/quarto"))) acao = 23;
  418. else if (vars.endsWith(F("/escada"))) acao = 72;
  419. /// Controle TV
  420. else if (vars.endsWith(F("/tv"))) acao = 25;
  421. else if (vars.endsWith(F("/input"))) acao = 26;
  422. else if (vars.endsWith(F("/menutv"))) acao = 27;
  423. else if (vars.endsWith(F("/setacima"))) acao = 28;
  424. else if (vars.endsWith(F("/setabaixo"))) acao = 29;
  425. else if (vars.endsWith(F("/esquerdatv"))) acao = 30;
  426. else if (vars.endsWith(F("/direitatv"))) acao = 31;
  427. else if (vars.endsWith(F("/volume+"))) acao = 32;
  428. else if (vars.endsWith(F("/volume-"))) acao = 33;
  429. else if (vars.endsWith(F("/exittv"))) acao = 34;
  430. else if (vars.endsWith(F("/voltar"))) acao = 35;
  431. else if (vars.endsWith(F("/mutetv"))) acao = 36;
  432. else if (vars.endsWith(F("/temp"))) acao = 37;
  433. else if (vars.endsWith(F("/netflix"))) acao = 38;
  434. else if (vars.endsWith(F("/enter"))) acao = 39;
  435. else if (vars.endsWith(F("/internet"))) acao = 70;
  436. /// Controle HOME
  437. else if (vars.endsWith(F("/home"))) acao = 40;
  438. else if (vars.endsWith(F("/funcao"))) acao = 41;
  439. else if (vars.endsWith(F("/volmenoshome"))) acao = 42;
  440. else if (vars.endsWith(F("/volmaishome"))) acao = 43;
  441. else if (vars.endsWith(F("/anterio"))) acao = 44;
  442. else if (vars.endsWith(F("/avancar"))) acao = 45;
  443. else if (vars.endsWith(F("/play"))) acao = 46;
  444. else if (vars.endsWith(F("/btncim"))) acao = 47;
  445. /// apartir daqui nao funciona comando
  446. else if (vars.endsWith(F("/btnbai"))) acao = 48;
  447. //Controle Ar
  448. else if (vars.endsWith(F("/ligarar"))) acao = 49;
  449. else if (vars.endsWith(F("/desliga_ar"))) acao = 50;
  450. else if (vars.endsWith(F("/modo"))) acao = 51;
  451. else if (vars.endsWith(F("/velocidade"))) acao = 52;
  452. else if (vars.endsWith(F("/maisar"))) acao = 53;
  453. else if (vars.endsWith(F("/menosar"))) acao = 54;
  454. /// fita led
  455. else if (vars.endsWith(F("/led"))) acao = 56;
  456. else if (vars.endsWith(F("/aumenta"))) acao = 57;
  457. else if (vars.endsWith(F("/diminui"))) acao = 58;
  458. else if (vars.endsWith(F("/azul"))) acao = 59;
  459. else if (vars.endsWith(F("/vermelho"))) acao = 60;
  460. else if (vars.endsWith(F("/verde"))) acao = 61;
  461. else if (vars.endsWith(F("/branco"))) acao = 62;
  462. else if (vars.endsWith(F("/flash"))) acao = 63;
  463. else if (vars.endsWith(F("/efei1"))) acao = 64;
  464. else if (vars.endsWith(F("/efei2"))) acao = 65;
  465. else if (vars.endsWith(F("/efei3"))) acao = 66;
  466. else if (vars.endsWith(F("/efei4"))) acao = 67;
  467. else if (vars.endsWith(F("/slow"))) acao = 68;
  468. else if (vars.endsWith(F("/quick"))) acao = 69;
  469. //// ultima açao 75
  470. if (acao == 3) { //liga , DESLIGANDO A TV
  471. //Ligar receptor
  472. irsend.sendNEC(0xFF50AF, 32);
  473. delay(200);
  474. //ligar tv
  475. irsend.sendNEC(0x2FD48B7, 32);
  476. Serial.println("tv receptor");
  477. lcd.setCursor(0,1);
  478. lcd.print(" Cena TV ");
  479. acao = 0;
  480. }
  481. if (acao == 4) { //Ok
  482.  
  483. irsend.sendNEC(0xFFB04F, 32);
  484. Serial.println("ok");
  485. lcd.setCursor(0,1);
  486. lcd.print(" OK ");
  487. acao = 0;
  488. }
  489. if (acao == 5) { //SetaDiretia
  490.  
  491. irsend.sendNEC(0xFF8877, 32);
  492. Serial.println("direita");
  493. lcd.setCursor(0,1);
  494. lcd.print(" Direita ");
  495. acao = 0;
  496. }
  497. if (acao == 6) { //seta esquerda
  498.  
  499. irsend.sendNEC(0xFF08F7, 32);
  500. Serial.println("esquerda");
  501. lcd.setCursor(0,1);
  502. lcd.print(" Esquerda ");
  503. acao = 0;
  504. }
  505. if (acao == 7) { //Seta cima
  506.  
  507. irsend.sendNEC(0xFFD02F, 32);
  508. Serial.println("cima");
  509. lcd.setCursor(0,1);
  510. lcd.print(" Cima ");
  511. acao = 0;
  512. }
  513. if (acao == 8) { //Seta baixo
  514.  
  515. irsend.sendNEC(0xFF708F, 32);
  516. Serial.println("baixo");
  517. lcd.setCursor(0,1);
  518. lcd.print(" Baixo ");
  519. acao = 0;
  520. }
  521. if (acao == 9){ //exit
  522.  
  523. irsend.sendNEC (0xFF7887, 32);
  524. Serial.println("exit");
  525. lcd.setCursor(0,1);
  526. lcd.print(" Exit ");
  527. acao = 0;
  528. }
  529. if (acao == 10){ //Sleep
  530.  
  531. irsend.sendNEC(0xFF6C93, 32);
  532. Serial.println("sleep");
  533. lcd.setCursor(0,1);
  534. lcd.print(" Sleep ");
  535. acao = 0;
  536. }
  537. if (acao == 11){ //Menu
  538.  
  539. irsend.sendNEC(0xFF58A7, 32);
  540. Serial.println("menu");
  541. lcd.setCursor(0,1);
  542. lcd.print(" Menu ");
  543. acao = 0;
  544. }
  545. if (acao == 12){ //+10
  546.  
  547. irsend.sendNEC(0xFF36C9, 32);
  548. Serial.println("+10");
  549. lcd.setCursor(0,1);
  550. lcd.print(" +10 ");
  551. acao = 0;
  552. }
  553.  
  554. if (acao == 75){ //-10
  555.  
  556. irsend.sendNEC(0xFFB649, 32);
  557. Serial.println("+10");
  558. lcd.setCursor(0,1);
  559. lcd.print(" -10 ");
  560. acao = 0;
  561. }
  562. if (acao == 13){ //canal 1
  563.  
  564. irsend.sendNEC(0xFF807F, 32);
  565. Serial.println("1");
  566. lcd.setCursor(0,1);
  567. lcd.print(" 1 ");
  568. acao = 0;
  569. }
  570. if (acao == 70){ //internet
  571.  
  572. irsend.sendNEC(0x2FD5BA4, 32);
  573. Serial.println("internet");
  574. lcd.setCursor(0,1);
  575. lcd.print(" Internet ");
  576. acao = 0;
  577. }
  578. if (acao == 14){ //2
  579.  
  580. irsend.sendNEC(0xFF40BF, 32);
  581. Serial.println("2");
  582. lcd.setCursor(0,1);
  583. lcd.print(" 2 ");
  584. acao = 0;
  585. }
  586. if (acao == 15){ //3
  587.  
  588. irsend.sendNEC(0xFFC03F, 32);
  589. Serial.println("3");
  590. lcd.setCursor(0,1);
  591. lcd.print("");
  592. acao = 0;
  593. }
  594. if (acao == 16){ //4
  595.  
  596. irsend.sendNEC(0xFF20DF, 32);
  597. Serial.println("4");
  598. lcd.setCursor(0,1);
  599. lcd.print(" 4 ");
  600. acao = 0;
  601. }
  602. if (acao == 17){ //5
  603.  
  604. irsend.sendNEC(0xFFA05F, 32);
  605. Serial.println("5");
  606. lcd.setCursor(0,1);
  607. lcd.print(" 5 ");
  608. acao = 0;
  609. }
  610. if (acao == 18){ //6
  611.  
  612. irsend.sendNEC(0xFF609F, 32);
  613. Serial.println("6");
  614. lcd.setCursor(0,1);
  615. lcd.print(" 6 ");
  616. acao = 0;
  617. }
  618. if (acao == 19){ //7
  619.  
  620. irsend.sendNEC(0xFFE01F, 32);
  621. Serial.println("7");
  622. lcd.setCursor(0,1);
  623. lcd.print(" 7 ");
  624. acao = 0;
  625.  
  626. }
  627. if (acao == 20){ //8
  628.  
  629. irsend.sendNEC (0xFF10EF, 32);
  630. Serial.println("8");
  631. lcd.setCursor(0,1);
  632. lcd.print(" 8 ");
  633. acao = 0;
  634. }
  635. if (acao == 21){ //9
  636.  
  637. irsend.sendNEC(0xFF906F, 32);
  638. Serial.println("9");
  639. lcd.setCursor(0,1);
  640. lcd.print(" 9 ");
  641. acao = 0;
  642. }
  643. if (acao == 22){ //0
  644.  
  645. irsend.sendNEC(0xFF00FF, 32);
  646. Serial.println("0");
  647. lcd.setCursor(0,1);
  648. lcd.print(" 0 ");
  649. acao = 0;
  650. }
  651. if (acao == 71){ //info
  652.  
  653. irsend.sendNEC(0xFF56A9, 32);
  654. Serial.println("informacao");
  655. lcd.setCursor(0,1);
  656. lcd.print(" Informacao ");
  657. acao = 0;
  658. }
  659. if (acao == 73){ //radio
  660.  
  661. irsend.sendNEC(0xFF2CD3, 32);
  662. Serial.println("radio");
  663. lcd.setCursor(0,1);
  664. lcd.print(" Radio ");
  665. acao = 0;
  666. }
  667. if (acao == 74){ //mute
  668.  
  669. irsend.sendNEC(0xFFCC33, 32);
  670. Serial.println("mudo");
  671. lcd.setCursor(0,1);
  672. lcd.print(" Mudo ");
  673. acao = 0;
  674. }
  675.  
  676. if (acao == 55) { //LIGANDO Receptor
  677. //Ligar receptor
  678. irsend.sendNEC(0xFF50AF, 32);
  679. Serial.println("Receptor");
  680. lcd.setCursor(0,1);
  681. lcd.print(" Receptor ");
  682. acao =0;
  683. ////////////////////// RELES //////////////////////////////////////
  684. }
  685. /// Reles
  686. if (acao == 24) { //Banheiro
  687. rele5 = !rele5;
  688. digitalWrite(pino_rele5, rele5);
  689. Serial.println("banheiro");
  690. lcd.setCursor(0,1);
  691. lcd.print(" Luz Banheiro ");
  692. acao = 0;
  693.  
  694. }
  695. if (acao == 23) { //Quarto
  696. rele4 = !rele4;
  697. digitalWrite(pino_rele4, rele4);
  698. Serial.println("quarto");
  699. lcd.setCursor(0,1);
  700. lcd.print(" Luz do Quarto ");
  701.  
  702. acao = 0;
  703. }
  704. if (acao == 72) { //escada
  705. rele6 = !rele6;
  706. digitalWrite(pino_rele6, rele6);
  707. Serial.println("escaa");
  708. lcd.setCursor(0,1);
  709. lcd.print(" Luz da Escada ");
  710. acao = 0;
  711. }
  712. //acao tv
  713. if (acao == 25){ //ligar tv
  714.  
  715. irsend.sendNEC(0x2FD48B7, 32);
  716. Serial.println("tv");
  717. lcd.setCursor(0,1);
  718. lcd.print(" Televisao ");
  719. acao = 0;
  720. }
  721. if (acao == 26){ //input
  722.  
  723. irsend.sendNEC(0x2FDF00F, 32);
  724. Serial.println("input");
  725. lcd.setCursor(0,1);
  726. lcd.print(" Input ");
  727. acao = 0;
  728. }
  729. if (acao == 27){ //menu
  730.  
  731. irsend.sendNEC(0x2FD01FE, 32);
  732. Serial.println("menutv");
  733. lcd.setCursor(0,1);
  734. lcd.print(" Menu TV ");
  735. acao = 0;
  736. }
  737. if (acao == 28){ //Cima
  738.  
  739. irsend.sendNEC(0x2FD41BE, 32);
  740. Serial.println("cima");
  741. lcd.setCursor(0,1);
  742. lcd.print(" Cima ");
  743. acao = 0;
  744. }
  745. if (acao == 29){ //baixo
  746.  
  747. irsend.sendNEC(0x2FDC13E, 32);
  748. Serial.println("baixo");
  749. lcd.setCursor(0,1);
  750. lcd.print(" Baixo ");
  751. acao = 0;
  752. }
  753. if (acao == 30){ //Esquerda
  754.  
  755. irsend.sendNEC(0x2FDB847, 32);
  756. Serial.println("esquerda");
  757. lcd.setCursor(0,1);
  758. lcd.print(" Esquerda ");
  759. acao = 0;
  760. }
  761. if (acao == 31){ //Direita
  762.  
  763. irsend.sendNEC(0x2FD9867, 32);
  764. Serial.println("direita");
  765. lcd.setCursor(0,1);
  766. lcd.print(" Direita ");
  767. acao = 0;
  768. }
  769. if (acao == 32){ //Vol +
  770.  
  771. irsend.sendNEC(0x2FD58A7, 32);
  772. Serial.println("vol");
  773. lcd.setCursor(0,1);
  774. lcd.print(" Volume + ");
  775. acao = 0;
  776. }
  777. if (acao == 33){ //vol -
  778.  
  779. irsend.sendNEC(0x2FD7887, 32);
  780. Serial.println("vol");
  781. lcd.setCursor(0,1);
  782. lcd.print(" Volume - ");
  783. acao = 0;
  784. }
  785. if (acao == 34){ //Exit
  786.  
  787. irsend.sendNEC(0x2FD1AE5, 32);
  788. Serial.println("exit");
  789. lcd.setCursor(0,1);
  790. lcd.print(" Exit ");
  791. acao = 0;
  792. }
  793. if (acao == 35){ //Voltar
  794.  
  795. irsend.sendNEC(0xFF00FF, 32);
  796. Serial.println("voltar");
  797. lcd.setCursor(0,1);
  798. lcd.print(" Voltar ");
  799. acao = 0;
  800. }
  801. if (acao == 36){ //mute
  802.  
  803. irsend.sendNEC(0x2FD08F7, 32);
  804. Serial.println("mute");
  805. lcd.setCursor(0,1);
  806. lcd.print(" Mudo ");
  807. acao = 0;
  808. }
  809. if (acao == 37){ //sleep
  810.  
  811. irsend.sendNEC(0x2FDA857, 32);
  812. Serial.println("Sleep");
  813. lcd.setCursor(0,1);
  814. lcd.print(" Sleep ");
  815. acao = 0;
  816. }
  817. if (acao == 38){ //netflix
  818.  
  819. irsend.sendNEC(0x2FD54AB, 32);
  820. Serial.println("netfix");
  821. lcd.setCursor(0,1);
  822. lcd.print(" Netflix ");
  823. acao = 0;
  824. }
  825. if (acao == 39){ //enter
  826.  
  827. irsend.sendNEC(0x2FD916E, 32);
  828. Serial.println("enter");
  829. lcd.setCursor(0,1);
  830. lcd.print(" Enter ");
  831. acao = 0;
  832. }
  833. /// Home
  834. if (acao == 40){ //ligar
  835.  
  836. irsend.sendRaw(S_pwr, 67, 38);
  837. Serial.println("home");
  838. lcd.setCursor(0,1);
  839. lcd.print(" Home Theather ");
  840. acao = 0;
  841. }
  842. if (acao == 41){ //funçao
  843.  
  844. irsend.sendRaw(S_fca, 67, 38);
  845. Serial.println("funcao");
  846. lcd.setCursor(0,1);
  847. lcd.print(" Funcao ");
  848. acao = 0;
  849. }
  850. if (acao == 42){ //vol -
  851.  
  852. irsend.sendRaw(S_vol, 67, 38);
  853. Serial.println("vol");
  854. lcd.setCursor(0,1);
  855. lcd.print(" Volume - ");
  856. acao = 0;
  857. }
  858. if (acao == 43){ //vol +
  859.  
  860. irsend.sendRaw(S_volm, 67, 38);
  861. Serial.println("vol");
  862. lcd.setCursor(0,1);
  863. lcd.print(" Volume + ");
  864. acao = 0;
  865. }
  866. if (acao == 44){ //anterior
  867.  
  868. irsend.sendRaw(S_ant, 67, 38);
  869. acao = 0;
  870. }
  871. if (acao == 45){ //avançar
  872.  
  873. irsend.sendRaw(S_ava, 67, 38);
  874. Serial.println("anterior");
  875. lcd.setCursor(0,1);
  876. lcd.print(" Anterior ");
  877. acao = 0;
  878. }
  879. if (acao == 46){ //play
  880.  
  881. irsend.sendRaw(S_pla, 67, 38);
  882. Serial.println("play");
  883. lcd.setCursor(0,1);
  884. lcd.print(" Play ");
  885. acao = 0;
  886. }
  887. if (acao == 47){ //cima
  888.  
  889. irsend.sendRaw(S_cim, 67, 38);
  890. Serial.println("cima");
  891. lcd.setCursor(0,1);
  892. lcd.print(" Cima ");
  893.  
  894. acao = 0;
  895. }
  896. if (acao == 48){ //baixo
  897.  
  898. irsend.sendRaw(S_bai, 67, 38);
  899. Serial.println("baixo");
  900. lcd.setCursor(0,1);
  901. lcd.print(" Baixo ");
  902. acao = 0;
  903. }
  904. //Ar condicionado
  905. if (acao == 49){ //ligar
  906.  
  907. irsend.sendRaw(lig_ar, 59, 38);
  908. Serial.println("ar");
  909. lcd.setCursor(0,1);
  910. lcd.print(" Ar Ligado ");
  911. acao = 0;
  912. }
  913. if (acao == 50){ //desligar
  914.  
  915. irsend.sendRaw(des_ar, 59, 38);
  916. Serial.println("ar");
  917. lcd.setCursor(0,1);
  918. lcd.print(" AR Desligado ");
  919. acao = 0;
  920. }
  921. if (acao == 51){ //modo
  922.  
  923. irsend.sendRaw(modo_ar, 59, 38);
  924. Serial.println("modo");
  925. lcd.setCursor(0,1);
  926. lcd.print(" Modo ");
  927. acao = 0;
  928. }
  929. if (acao == 52){ //velocidade
  930.  
  931. irsend.sendRaw(velocidade_ar, 61, 38);
  932. Serial.println("velocidade");
  933. lcd.setCursor(0,1);
  934. lcd.print(" Velocidade ");
  935. acao = 0;
  936. }
  937. if (acao == 53){ //mais Ar
  938.  
  939. irsend.sendRaw(aumenta_ar, 59, 38);
  940. Serial.println("netfix");
  941. lcd.setCursor(0,1);
  942. lcd.print(" Ar + ");
  943. acao = 0;
  944. }
  945. if (acao == 54){ //menos ar
  946.  
  947. irsend.sendRaw(diminui_ar, 59, 38);
  948. irsend.sendRaw(aumenta_ar, 59, 38);
  949. Serial.println("netfix");
  950. lcd.setCursor(0,1);
  951. lcd.print(" Ar - ");
  952. acao = 0;
  953. }
  954. // Fita Led
  955.  
  956. if (acao ==56){ // liga Fita Led
  957.  
  958. irsend.sendNEC(0xFF02FD, 32);
  959. irsend.sendRaw(aumenta_ar, 59, 38);
  960. Serial.println("led");
  961. lcd.setCursor(0,1);
  962. lcd.print(" Fita de Led ");
  963. acao = 0;
  964. }
  965. if (acao ==57){ //aumentaFita Led
  966.  
  967. irsend.sendNEC(0xFF3AC5, 32);
  968. irsend.sendRaw(aumenta_ar, 59, 38);
  969. Serial.println("brilho");
  970. lcd.setCursor(0,1);
  971. lcd.print(" Brilho +");
  972. acao = 0;
  973. ;
  974. }
  975. if (acao ==58){ // diminii Fita Led
  976.  
  977. irsend.sendNEC(0xFFBA45, 32);
  978. Serial.println("brilho");
  979. lcd.setCursor(0,1);
  980. lcd.print(" Brilho - ");
  981. acao = 0;
  982. }
  983. if (acao ==59){ // azul Fita Led
  984.  
  985. irsend.sendNEC(0xFF1AE5, 32);
  986. Serial.println("azul");
  987. lcd.setCursor(0,1);
  988. lcd.print(" Azul ");
  989. acao = 0;
  990. }
  991. if (acao ==60){ // vermelho Fita Led
  992.  
  993. irsend.sendNEC(0xFF9A65, 32);
  994. Serial.println("ver");
  995. lcd.setCursor(0,1);
  996. lcd.print(" Vermelho ");
  997. acao = 0;
  998. }
  999. if (acao ==61){ // verde Fita Led
  1000.  
  1001. irsend.sendNEC(0xFFA25D, 32);
  1002. Serial.println("verde");
  1003. lcd.setCursor(0,1);
  1004. lcd.print(" Verde ");
  1005. acao = 0;
  1006. }
  1007. if (acao ==62){ // branco Fita Led
  1008.  
  1009. irsend.sendNEC(0xFF22DD, 32);
  1010. Serial.println("branco");
  1011. lcd.setCursor(0,1);
  1012. lcd.print(" Branco ");
  1013. acao = 0;
  1014. }
  1015. if (acao ==63){ // flash Fita Led
  1016.  
  1017. irsend.sendNEC(0xFFD02F, 32);
  1018. Serial.println("flash");
  1019. lcd.setCursor(0,1);
  1020. lcd.print(" Flash ");
  1021. acao = 0;
  1022. }
  1023. if (acao ==64){ // efeito 1 Fita Led
  1024.  
  1025. irsend.sendNEC(0xFF20DF, 32);
  1026. Serial.println("E1");
  1027. lcd.setCursor(0,1);
  1028. lcd.print(" Efeito 1 ");
  1029. acao = 0;
  1030. }
  1031. if (acao ==65){ // efeito 2 Fita Led
  1032.  
  1033. irsend.sendNEC(0xFFA05F, 32);
  1034. Serial.println("E2");
  1035. lcd.setCursor(0,1);
  1036. lcd.print(" Efeito 2 ");
  1037. acao = 0;
  1038. }
  1039. if (acao ==66){ // efeito 3 Fita Led
  1040.  
  1041. irsend.sendNEC(0xFF609F, 32);
  1042. Serial.println("E3");
  1043. lcd.setCursor(0,1);
  1044. lcd.print(" Efeito 3 ");
  1045. acao = 0;
  1046. }
  1047. if (acao ==67){ // efeito 4 Fita Led
  1048.  
  1049. irsend.sendNEC(0xFFE01F, 32);
  1050. Serial.println("E4");
  1051. lcd.setCursor(0,1);
  1052. lcd.print(" Efeito 4 ");
  1053. acao = 0;
  1054. }
  1055. if (acao ==68){ // Slow Fita Led
  1056.  
  1057. irsend.sendNEC(0xFFC837, 32);
  1058. Serial.println("Slow");
  1059. lcd.setCursor(0,1);
  1060. lcd.print(" Slow ");
  1061. acao = 0;
  1062. }
  1063. if (acao ==69){ // Quick Fita Led
  1064.  
  1065. irsend.sendNEC(0xFFE817, 32);
  1066. Serial.println("Quick");
  1067. lcd.setCursor(0,1);
  1068. lcd.print(" Quick ");
  1069. acao = 0;
  1070. }
  1071.  
  1072. ///////
  1073. } //Final do Cliente conectado
  1074.  
  1075.  
  1076. irrecv.enableIRIn();
  1077. client.stop();
  1078. } //Final do if client
  1079.  
  1080.  
  1081. }
  1082. }
  1083. //LOOP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement