Guest User

codigo

a guest
Dec 27th, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 KB | None | 0 0
  1. #include <IRremote.h>
  2.  
  3. IRsend irsend;
  4.  
  5. int led = 3;
  6. int led1 = 8;
  7. int ch1 = 4;
  8. int ch2 = 5;
  9. int ch3 = 6;
  10. int ch4 = 7;
  11. 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,};
  12. 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,};
  13. 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,};
  14. 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,};
  15. unsigned int S_ant[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,550,550,600,1600,600,1650,600,500,600,500,550,550,600,500,600,550,550,1650,600,500,600,500,600,1650,550,1650,600,1600,600,};
  16. 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,};
  17. 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,};
  18. 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,};
  19. 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,};
  20.  
  21. void setup()
  22. {
  23. Serial.begin(9600);
  24. pinMode(led,OUTPUT); //infravermelho;
  25. pinMode(led1,OUTPUT);//infravermelho2;
  26. pinMode(ch1, OUTPUT);//Pino digital saída do Arduino(4-ch1);
  27. pinMode(ch2, OUTPUT);//Pino digital saída do Arduino(5-ch2);
  28. pinMode(ch3, OUTPUT);//Pino digital saída do Arduino(6-ch3);
  29. pinMode(ch4, OUTPUT);//Pino digital saída do Arduino(7-ch4);
  30. }
  31. void loop() {
  32. char valorlido = Serial.read();
  33.  
  34. //Controle da tv //
  35.  
  36. switch(valorlido) {case 'a': irsend.sendNEC (0x2FD48B7, 32); // Power break;
  37. }
  38. switch(valorlido) {case 'b': irsend.sendNEC (0x2FDF00F, 32); // Input;
  39. }
  40. switch(valorlido) {case 'c': irsend.sendNEC (0x2FD01FE, 32); // Menu;
  41. }
  42. switch(valorlido) {case 'd': irsend.sendNEC (0x2FD41BE, 32); // Tecla Cima;
  43. }
  44. switch(valorlido) {case 'e': irsend.sendNEC (0x2FDC13E, 32); // Tecla Baixo;
  45. }
  46. switch(valorlido) {case 'f': irsend.sendNEC (0x2FDB847, 32); // Tecla Esquerda;
  47. }
  48. switch(valorlido) {case 'g': irsend.sendNEC (0x2FD9867, 32); // Tecla Direita;
  49. }
  50. switch(valorlido) {case 'h': irsend.sendNEC (0x2FD58A7, 32); // Volume +;
  51. }
  52. switch(valorlido) {case 'i': irsend.sendNEC (0x2FD7887, 32); // Volume -;
  53. }
  54. switch(valorlido) {case 'j': irsend.sendNEC (0x2FDD827, 32); // Canal +;
  55. }
  56. switch(valorlido) {case 'k': irsend.sendNEC (0x2FDF807, 32); // Canal -;
  57. }
  58. switch(valorlido) {case 'l': irsend.sendNEC (0x2FD08F7, 32); // Mute;
  59. }
  60. switch(valorlido) {case 'z': irsend.sendNEC (0x2FD916E, 32); // Enter;
  61. }
  62. switch(valorlido) {case 'A': irsend.sendNEC (0x2FD20DF, 32); // Sbt:
  63. }
  64. switch(valorlido) {case 'B': irsend.sendNEC (0x2FDA05F, 32); // Globo:
  65. }
  66. switch(valorlido) {case 'C': irsend.sendNEC (0x2FDE01F, 32); // Record:
  67. }
  68. switch(valorlido) {case 'D': irsend.sendNEC (0x2FD906F, 32); // Rede tv:
  69. }
  70.  
  71. //Controle Home;
  72. switch(valorlido) {case 'G': irsend.sendRaw (S_pwr,67, 38); // Power break;
  73. }
  74. switch(valorlido) {case 'H': irsend.sendRaw (S_fca,67, 38); // funcao;
  75. }
  76. switch(valorlido) {case 'I': irsend.sendRaw (S_vol,67, 38); // Volume - ;
  77. }
  78. switch(valorlido) {case 'J': irsend.sendRaw (S_volm,67, 38); // Volume +;
  79. }
  80. switch(valorlido) {case 'K': irsend.sendRaw (S_volm,67, 38); // anterior;
  81. }
  82. switch(valorlido) {case 'L': irsend.sendRaw (S_ava,67, 38); // avancar;
  83. }
  84. switch(valorlido) {case 'M': irsend.sendRaw (S_pla,67, 38); //play;
  85. }
  86. switch(valorlido) {case 'N': irsend.sendRaw (S_cim,67, 38); //cima;
  87. }
  88. switch(valorlido) {case 'O': irsend.sendRaw (S_bai,67, 38);//baixo;
  89. }
  90.  
  91. //FITA DE LED;
  92. switch(valorlido) {case 'm': irsend.sendNEC (0xFF02FD, 32); // Power;
  93. }
  94. switch(valorlido) {case 'n': irsend.sendNEC (0xFF3AC5, 32); // Aumentar Brilho;
  95. }
  96. switch(valorlido) {case 'o': irsend.sendNEC (0xFFBA45, 32); // Diminuir Brilho;
  97. }
  98. switch(valorlido) {case 'p': irsend.sendNEC (0xFF9A65, 32); // Vermelho;
  99. }
  100. switch(valorlido) {case 'q': irsend.sendNEC (0xFF1AE5, 32); // Verde;
  101. }
  102. switch(valorlido) {case 'r': irsend.sendNEC (0xFFA25D, 32); // Azul;
  103. }
  104. switch(valorlido) {case 's': irsend.sendNEC (0xFF22DD, 32); // Branco;
  105. }
  106. switch(valorlido) {case 't': irsend.sendNEC (0xFFE817, 32); // + Velocidade;
  107. }
  108. switch(valorlido) {case 'u': irsend.sendNEC (0xFFC837, 32); // - Velocidade;
  109. }
  110. switch(valorlido) {case 'v': irsend.sendNEC (0xFFF00F, 32); // Auto;
  111. }
  112. switch(valorlido) {case 'y': irsend.sendNEC (0xFFD02F, 32); // Flash;
  113. }
  114. switch(valorlido) {case 'x': irsend.sendNEC (0xFFE01F, 32); // Efeito 1;
  115. }
  116. switch(valorlido) {case 'w': irsend.sendNEC (0xFF609F, 32); // Efeito 2;
  117. }
  118. //LAMPADAS:
  119.  
  120. //CANAL 1//
  121.  
  122. switch(valorlido) {case '1':digitalWrite(ch1, !digitalRead(ch1));//Quarto;
  123. }
  124. switch(valorlido) {case '5':digitalWrite(ch2, !digitalRead(ch2));//NULO;
  125. }
  126. switch(valorlido) {case '3':digitalWrite(ch3, !digitalRead(ch3));//escada;
  127. }
  128. switch(valorlido) {case '4':digitalWrite(ch4, !digitalRead(ch4)); // Banheiro
  129. }
  130.  
  131. delay(10);
  132. }
Add Comment
Please, Sign In to add comment