Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- IRsend irsend;
- int RECV_PIN = 11;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- int con = 9;
- int led = 3;
- int led1 = 8;
- int ch1 = 4;
- int ch2 = 5;
- int ch3 = 6;
- int ch4 = 7;
- 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]={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,};
- 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,};
- void setup()
- {
- Serial.begin(9600);
- irrecv.enableIRIn();
- pinMode(led,OUTPUT); //infravermelho;
- pinMode(led1,OUTPUT);//infravermelho2;
- pinMode(ch1, OUTPUT);//Pino digital saÃda do Arduino(4-ch1);
- pinMode(ch2, OUTPUT);//Pino digital saÃda do Arduino(5-ch2);
- pinMode(ch3, OUTPUT);//Pino digital saÃda do Arduino(6-ch3);
- pinMode(ch4, OUTPUT);//Pino digital saÃda do Arduino(7-ch4);
- }
- void loop() {
- char valorlido = Serial.read();
- //CONTROLE UNIVERSAL//
- switch (results.value == 0xFFA25D) { digitalWrite(ch1, HIGH);
- }
- switch (results.value == 0xFF629D) { digitalWrite(ch1, HIGH);
- }
- switch (results.value == 0xFF629D) { digitalWrite(con, HIGH);
- }
- //Controle da tv /////SEMPRE QUE COLOCO ESSE CODIGO EM NEGRITO NAO FUNCIONA O CONTROLE///
- switch(valorlido)
- {
- case 'a': irsend.sendNEC (0x2FD48B7, 32); break; // Power break;
- case 'b': irsend.sendNEC (0x2FDF00F, 32); break; // Input;
- case 'c': irsend.sendNEC (0x2FD01FE, 32); break; // Menu;
- case 'd': irsend.sendNEC (0x2FD41BE, 32); break; // Tecla Cima;
- case 'e': irsend.sendNEC (0x2FDC13E, 32); break; // Tecla Baixo;
- case 'f': irsend.sendNEC (0x2FDB847, 32); break; // Tecla Esquerda;
- case 'g': irsend.sendNEC (0x2FD9867, 32); break; // Tecla Direita;
- case 'h': irsend.sendNEC (0x2FD58A7, 32); break; // Volume +;
- case 'i': irsend.sendNEC (0x2FD7887, 32); break; // Volume -;
- case 'j': irsend.sendNEC (0x2FDD827, 32); break; // Canal +;
- case 'k': irsend.sendNEC (0x2FDF807, 32); break; // Canal -;
- case 'l': irsend.sendNEC (0x2FD08F7, 32); break; // Mute;
- case 'z': irsend.sendNEC (0x2FD916E, 32); break; // Enter;
- case 'A': irsend.sendNEC (0x2FD20DF, 32); break; // Sbt:
- case 'B': irsend.sendNEC (0x2FDA05F, 32); break; // Globo:
- case 'C': irsend.sendNEC (0x2FDE01F, 32); break; // Record:
- case 'D': irsend.sendNEC (0x2FD906F, 32); break; // Rede tv:
- //Controle Home;
- case 'G': irsend.sendRaw (S_pwr,67, 38); break; // Power break;
- case 'H': irsend.sendRaw (S_fca,67, 38); break; // funcao;
- case 'I': irsend.sendRaw (S_vol,67, 38); break; // Volume - ;
- case 'J': irsend.sendRaw (S_volm,67, 38); break; // Volume +;
- case 'K': irsend.sendRaw (S_volm,67, 38); break; // anterior;
- case 'L': irsend.sendRaw (S_ava,67, 38); break; // avancar;
- case 'M': irsend.sendRaw (S_pla,67, 38); break; //play;
- case 'N': irsend.sendRaw (S_cim,67, 38); break; //cima;
- case 'O': irsend.sendRaw (S_bai,67, 38); break; //baixo;
- //FITA DE LED;
- case 'm': irsend.sendNEC (0xFF02FD, 32); break; // Power;
- case 'n': irsend.sendNEC (0xFF3AC5, 32); break; // Aumentar Brilho;
- case 'o': irsend.sendNEC (0xFFBA45, 32); break; // Diminuir Brilho;
- case 'p': irsend.sendNEC (0xFF9A65, 32); break; // Vermelho;
- case 'q': irsend.sendNEC (0xFF1AE5, 32); break; // Verde;
- case 'r': irsend.sendNEC (0xFFA25D, 32); break; // Azul;
- case 's': irsend.sendNEC (0xFF22DD, 32); break; // Branco;
- case 't': irsend.sendNEC (0xFFE817, 32); break; // + Velocidade;
- case 'u': irsend.sendNEC (0xFFC837, 32); break; // - Velocidade;
- case 'v': irsend.sendNEC (0xFFF00F, 32); break; // Auto;
- case 'y': irsend.sendNEC (0xFFD02F, 32); break; // Flash;
- case 'x': irsend.sendNEC (0xFFE01F, 32); break; // Efeito 1;
- case 'w': irsend.sendNEC (0xFF609F, 32); break; // Efeito 2;
- //LAMPADAS:
- //CANAL 1//
- case '1':digitalWrite(ch1, !digitalRead(ch1)); break; //Quarto;
- case '5':digitalWrite(ch2, !digitalRead(ch2)); break; //NULO;
- case '3':digitalWrite(ch3, !digitalRead(ch3)); break; //escada;
- case '4':digitalWrite(ch4, !digitalRead(ch4)); break; // Banheiro
- }
- delay(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement