codigo ta certo , mais nao quer ligar oS pinos  com o controle oque pode ser 

 

CODIGO QUE PRECISO MAIS NAO FUNCIONA O CONTROLE

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#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); // Power break;
}
switch(valorlido) {case 'b': irsend.sendNEC (0x2FDF00F, 32); // Input;
}
switch(valorlido) {case 'c': irsend.sendNEC (0x2FD01FE, 32); // Menu;
}
switch(valorlido) {case 'd': irsend.sendNEC (0x2FD41BE, 32); // Tecla Cima;
}
switch(valorlido) {case 'e': irsend.sendNEC (0x2FDC13E, 32); // Tecla Baixo;
}
switch(valorlido) {case 'f': irsend.sendNEC (0x2FDB847, 32); // Tecla Esquerda;
}
switch(valorlido) {case 'g': irsend.sendNEC (0x2FD9867, 32); // Tecla Direita;
}
switch(valorlido) {case 'h': irsend.sendNEC (0x2FD58A7, 32); // Volume +;
}
switch(valorlido) {case 'i': irsend.sendNEC (0x2FD7887, 32); // Volume -;
}
switch(valorlido) {case 'j': irsend.sendNEC (0x2FDD827, 32); // Canal +;
}
switch(valorlido) {case 'k': irsend.sendNEC (0x2FDF807, 32); // Canal -;
}
switch(valorlido) {case 'l': irsend.sendNEC (0x2FD08F7, 32); // Mute;
}
switch(valorlido) {case 'z': irsend.sendNEC (0x2FD916E, 32); // Enter;
}
switch(valorlido) {case 'A': irsend.sendNEC (0x2FD20DF, 32); // Sbt:
}
switch(valorlido) {case 'B': irsend.sendNEC (0x2FDA05F, 32); // Globo:
}
switch(valorlido) {case 'C': irsend.sendNEC (0x2FDE01F, 32); // Record:
}
switch(valorlido) {case 'D': irsend.sendNEC (0x2FD906F, 32); // Rede tv:
}

//Controle Home;
switch(valorlido) {case 'G': irsend.sendRaw (S_pwr,67, 38); // Power break;
}
switch(valorlido) {case 'H': irsend.sendRaw (S_fca,67, 38); // funcao;
}
switch(valorlido) {case 'I': irsend.sendRaw (S_vol,67, 38); // Volume - ;
}
switch(valorlido) {case 'J': irsend.sendRaw (S_volm,67, 38); // Volume +;
}
switch(valorlido) {case 'K': irsend.sendRaw (S_volm,67, 38); // anterior;
}
switch(valorlido) {case 'L': irsend.sendRaw (S_ava,67, 38); // avancar;
}
switch(valorlido) {case 'M': irsend.sendRaw (S_pla,67, 38); //play;
}
switch(valorlido) {case 'N': irsend.sendRaw (S_cim,67, 38); //cima;
}
switch(valorlido) {case 'O': irsend.sendRaw (S_bai,67, 38);//baixo;
}

//FITA DE LED;
switch(valorlido) {case 'm': irsend.sendNEC (0xFF02FD, 32); // Power;
}
switch(valorlido) {case 'n': irsend.sendNEC (0xFF3AC5, 32); // Aumentar Brilho;
}
switch(valorlido) {case 'o': irsend.sendNEC (0xFFBA45, 32); // Diminuir Brilho;
}
switch(valorlido) {case 'p': irsend.sendNEC (0xFF9A65, 32); // Vermelho;
}
switch(valorlido) {case 'q': irsend.sendNEC (0xFF1AE5, 32); // Verde;
}
switch(valorlido) {case 'r': irsend.sendNEC (0xFFA25D, 32); // Azul;
}
switch(valorlido) {case 's': irsend.sendNEC (0xFF22DD, 32); // Branco;
}
switch(valorlido) {case 't': irsend.sendNEC (0xFFE817, 32); // + Velocidade;
}
switch(valorlido) {case 'u': irsend.sendNEC (0xFFC837, 32); // - Velocidade;
}
switch(valorlido) {case 'v': irsend.sendNEC (0xFFF00F, 32); // Auto;
}
switch(valorlido) {case 'y': irsend.sendNEC (0xFFD02F, 32); // Flash;
}
switch(valorlido) {case 'x': irsend.sendNEC (0xFFE01F, 32); // Efeito 1;
}
switch(valorlido) {case 'w': irsend.sendNEC (0xFF609F, 32); // Efeito 2;
}
//LAMPADAS:

//CANAL 1//

switch(valorlido) {case '1':digitalWrite(ch1, !digitalRead(ch1));//Quarto;
}
switch(valorlido) {case '5':digitalWrite(ch2, !digitalRead(ch2));//NULO;
}
switch(valorlido) {case '3':digitalWrite(ch3, !digitalRead(ch3));//escada;
}
switch(valorlido) {case '4':digitalWrite(ch4, !digitalRead(ch4)); // Banheiro
}
delay(10);
}

Exibições: 315

Responder esta

Respostas a este tópico

kra, vc esta usando o comando SWITCH errado... esse codigo nao esta nada "certo"... dah uma olhada em https://www.arduino.cc/en/Reference/SwitchCase

vou dar uma olhada Flavio valeu a dica link nao vai : /

#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);
}

switch(valorlido) {case 'a': irsend.sendNEC (0x2FD48B7, 32); // Power break;

}
delay(10);
}

Oi LC,

Veja a correção neste link:

http://pastebin.com/e0H0i7KK

Rui

Boa tarde Rui entao eu coloque nao funciona 

se eu colocar esse codigo funciona consgo ligar o led com controle remoto 

http://pastebin.com/qV67BBFR

agora esse outro é que agnt fez funciona normal

ueria deixa os 2 code  juntos na mesma sketch  pra funcionar

http://pastebin.com/bxXZ03yW

se peder me ajuda agradeço mt

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço