Boa tarde amigos,

Criei um código pra controle remoto da minha tv.

o IDE Verifica o código como certo, diz que ele tem 9.770b, mas quando eu vou subir o código no meu leonardo. O arduino simplesmente trava e o RX fica acesso direto.

esse é o codigo

#include <IRremote.h>

IRsend irsend;
unsigned int raw1[68] = {8900,4450,600,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,550,1650,600,1650,550,1650,600,1650,600,1650,550,1650,600,550,600,1650,550,1650,600,1650,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,550,550,1650,600,1650,600,1650,600,1650,550,1650,600,1650,600,};
unsigned int raw2[68] = {8950,4500,550,550,600,500,600,550,550,550,600,550,550,600,550,550,550,550,600,1650,550,1650,600,1650,600,1650,600,1600,600,1650,600,550,550,1650,600,550,600,1600,600,1650,600,1650,600,1650,550,600,550,550,550,600,550,1700,550,550,550,550,550,600,550,550,550,1700,550,1700,550,1700,550,};
unsigned int raw3[68] = {8950,4450,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,550,550,1650,600,1650,600,1650,600,1650,550,1650,600,1650,600,550,550,1650,600,550,550,550,600,550,550,550,600,550,550,550,600,550,550,550,550,1700,550,1650,600,1650,600,1650,550,1650,600,1650,600,1650,550,1700,550,};
unsigned int raw4[68] = {8950,4450,600,550,550,550,600,550,550,550,550,600,550,550,550,600,550,550,550,1650,600,1650,600,1650,550,1700,550,1650,600,1650,600,550,550,1650,600,1650,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,550,550,1650,600,1650,600,1650,550,1650,600,1650,600,1650,550,1650,600,};
unsigned int raw5[68] = {8900,4500,550,550,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,1650,600,1650,550,1650,600,1650,600,1650,550,1700,550,550,600,1650,550,600,550,1650,600,550,550,550,550,600,550,550,550,600,550,550,550,1650,600,550,550,1700,550,1650,600,1650,600,1650,550,1650,600,1650,600,};
unsigned int raw6[68] = {8950,4450,600,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,550,1650,600,1650,550,1650,600,1650,600,1650,550,1650,600,550,600,1650,550,550,600,550,550,1650,600,550,550,600,550,550,550,550,600,550,550,1650,600,1650,600,550,550,1650,600,1650,550,1700,550,1650,600,1650,600,};
unsigned int raw7[68] = {9000,4450,550,600,550,550,550,550,600,550,550,550,600,550,550,550,600,550,550,1650,600,1650,550,1700,550,1650,600,1650,600,1650,550,550,600,1650,550,1700,550,550,600,1650,550,600,550,550,550,550,600,550,550,550,600,550,550,1650,600,550,550,1650,600,1650,600,1650,550,1650,600,1650,600,};
unsigned int raw8[68] = {8950,4450,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,550,550,1700,550,1700,550,1650,550,1700,550,1650,600,1700,550,550,550,1650,600,550,550,1650,600,1700,550,550,550,550,600,550,550,550,550,600,550,1650,600,550,550,550,600,1650,550,1650,600,1700,550,1700,500,1700,550,};
unsigned int raw9[68] = {8950,4450,600,550,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,1650,550,1650,600,1650,600,1650,600,1650,550,1650,600,550,550,1650,600,550,600,500,600,550,550,1650,600,550,600,550,550,550,600,550,550,1650,600,1650,550,1650,600,550,600,1650,550,1650,600,1650,600,1650,550,};
unsigned int raw10[68] = {8950,4500,550,550,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,1700,550,1700,500,1750,500,1700,550,1700,500,1750,500,550,600,1700,500,1700,550,550,600,500,600,1700,550,550,550,550,600,500,600,550,550,550,600,1700,550,1600,600,600,550,1700,550,1650,550,1700,550,1700,550,};
unsigned int raw11[68] = {8950,4450,600,550,550,550,550,600,550,550,550,600,550,500,600,600,550,550,550,1650,600,1650,600,1600,600,1650,600,1650,600,1650,550,550,600,1650,600,500,600,1650,600,550,550,1650,600,500,600,600,550,550,550,600,550,1650,550,600,550,1650,600,550,550,1650,600,1650,600,1600,600,1650,600,};
unsigned int raw12[68] = {8950,4500,550,550,600,500,600,550,600,500,600,550,550,550,600,550,550,550,600,1650,600,1650,550,1650,600,1650,600,1650,550,1650,600,550,600,1650,550,1650,600,550,550,1650,600,1650,600,550,550,550,600,550,550,550,600,500,600,1650,600,550,550,550,600,1650,550,1650,600,1650,600,1650,600,};
unsigned int raw14[68] = {9050,4400,600,500,650,500,600,500,650,500,600,500,650,500,600,500,650,500,600,1600,650,1600,650,1600,600,1600,650,1600,650,1600,600,500,650,1600,650,450,650,500,600,1650,600,1600,650,1600,650,450,650,500,650,450,650,1600,650,1600,600,500,650,500,600,500,650,1600,600,1650,600,1600,650,};
unsigned int raw15[68] = {8950,4500,550,600,500,650,500,600,500,650,500,600,500,650,450,650,500,650,450,1700,550,1700,550,1650,550,1700,550,1700,550,1650,600,550,550,1700,550,600,500,650,500,1650,550,600,550,650,450,600,550,1650,550,600,550,1650,600,1650,550,600,550,1650,600,1650,550,1700,550,600,500,1700,550,};
unsigned int raw16[68] = {8950,4450,600,550,550,600,550,550,550,550,600,550,550,550,600,550,550,550,600,1650,550,1650,600,1650,600,1650,550,1650,600,1650,600,550,550,1650,600,1650,600,550,550,1650,600,1650,600,1650,550,550,600,550,550,550,600,550,550,1650,600,550,550,550,600,550,550,1650,600,1650,600,1650,550,};
unsigned int raw17[68] = {8950,4500,550,550,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,1650,550,1650,600,1650,600,1650,600,1650,550,1650,600,550,550,1650,600,1650,600,550,550,1650,600,550,550,600,550,550,550,1650,600,550,600,550,550,1650,600,550,550,1650,600,1650,600,1650,550,550,600,1650,550,};
unsigned int raw18[68] = {8950,4500,550,650,450,700,450,650,450,650,500,650,450,650,500,650,450,650,500,1650,550,1700,550,1700,550,1650,550,1700,550,1700,550,650,450,1700,550,650,450,700,450,650,450,650,500,650,450,650,500,1650,550,650,500,1650,600,1650,200,2050,250,2000,150,2050,150,2100,550,650,500,1650,200,};
unsigned int raw19[68] = {8900,4500,550,600,550,550,550,550,600,550,550,550,600,550,550,550,600,550,550,1650,600,1650,550,1650,600,1650,600,1650,600,1600,600,550,600,1650,550,550,600,1650,600,550,550,550,550,600,550,550,550,1700,550,550,600,1650,550,550,600,1700,500,1700,550,1700,550,1700,550,500,600,1700,550,};
unsigned int raw20[68] = {8950,4500,550,550,550,600,550,550,550,550,600,550,550,550,600,550,550,550,600,1600,600,1650,600,1650,600,1600,600,1650,600,1650,600,550,550,1650,600,1650,600,500,600,550,600,500,600,600,550,550,550,1650,600,550,550,550,600,1600,600,1700,550,1650,600,1700,500,1700,550,550,600,1700,500,};
unsigned int raw21[68] = {8950,4450,550,600,550,550,550,550,600,550,550,550,600,550,550,550,600,550,550,1650,600,1650,550,1700,550,1650,600,1650,600,1650,550,550,600,1650,550,1700,550,1650,600,1650,600,550,550,1650,600,550,550,550,600,550,550,550,600,550,550,550,550,1700,550,550,600,1650,550,1650,600,1650,600,};
unsigned int raw22[68] = {8900,4500,550,550,600,550,550,550,600,550,550,550,600,550,550,550,550,600,550,1650,600,1650,550,1650,600,1650,600,1650,550,1700,550,550,600,1650,550,600,550,1650,600,1650,550,1650,600,550,550,600,550,550,550,600,550,1650,600,550,550,550,550,600,550,1650,600,1650,550,1650,600,1650,600,};
unsigned int raw23[68] = {8900,4450,600,550,600,550,550,550,550,600,550,550,550,600,550,550,550,550,600,1650,550,1700,550,1650,600,1650,600,1650,550,1650,600,550,600,1650,550,550,600,1650,550,1650,600,550,600,1650,550,550,600,550,550,550,600,1650,550,600,550,550,550,1650,600,550,550,1700,550,1650,600,1650,600,};
unsigned int raw24[68] = {8950,4500,550,550,600,550,550,550,550,600,550,550,550,600,550,550,550,550,600,1650,550,1700,550,1650,600,1650,600,1650,550,1650,600,550,550,1700,550,550,600,1650,550,600,550,1650,600,1650,550,550,600,550,550,550,600,1650,550,550,600,1650,550,600,550,550,550,1650,600,1650,600,1650,600,};
unsigned int raw25[68] = {8900,4450,600,550,550,550,550,600,550,600,500,650,500,650,450,550,600,600,500,1750,500,1700,550,1700,500,1750,500,1750,500,1700,500,600,550,1700,550,1650,550,550,600,1700,550,550,550,1700,550,550,550,550,600,500,600,550,600,1650,550,550,600,1700,500,600,550,1700,550,1650,550,1700,550,};
unsigned int raw26[68] = {8950,4450,600,550,600,550,550,550,550,600,550,550,550,600,550,550,550,550,600,1650,550,1700,550,1650,600,1650,600,1650,550,1650,600,550,550,1700,550,550,600,550,550,1650,600,550,550,1650,600,550,550,600,550,550,550,1650,600,1650,600,550,550,1650,600,550,550,1650,600,1650,600,1650,600,};
unsigned int raw27[68] = {9000,4450,550,600,550,550,550,600,550,550,550,550,600,550,550,550,600,550,550,1650,600,1650,600,1650,550,1650,600,1650,600,1650,550,600,550,1650,600,550,550,550,550,600,550,1650,600,1650,550,600,550,550,550,550,600,1650,550,1700,550,1650,600,550,550,600,550,1650,600,1650,550,1650,600,};


void setup()
{
Serial.begin(9600);
}
void loop() {
int valor = Serial.read();

switch (valor) {
case '1':
irsend.sendRaw(raw1,68,38); //liga tv
break;
case '2':
irsend.sendRaw(raw2,68,38);
//Source tv
break;
case '3':
irsend.sendRaw(raw3,68,38); //1 tv
break;
case '4':
irsend.sendRaw(raw4,68,38); //2 tv
break;
case '5':
irsend.sendRaw(raw5,68,38); // 3 tv
break;
case '6':
irsend.sendRaw(raw6,68,38); //4 tv
break;
case '7':
irsend.sendRaw(raw7,68,38);//5 tv
break;
case '8':
irsend.sendRaw(raw8,68,38); //6 tv
break;
case '9':
irsend.sendRaw(raw9,68,38); //7 tv
break;
case '10':
irsend.sendRaw(raw10,68,38); //8 tv
break;
case '11':
irsend.sendRaw(raw11,68,38);//9 tv
break;
case '12':
irsend.sendRaw(raw12,68,38); //0 tv
break;
case '14':
irsend.sendRaw(raw14,68,38); //menu tv
break;
case '15':
irsend.sendRaw(raw16,68,38); // seta cima tv
break;
case '16':
irsend.sendRaw(raw15,68,38); //exit tv
break;
case '17':
irsend.sendRaw(raw18,68,38); //zoom - tv
break;
case '18':
irsend.sendRaw(raw20,68,38); //ok tv
break;
case '19':
irsend.sendRaw(raw19,68,38); //zoom+ tv
break;
case '20':
irsend.sendRaw(raw21,68,38); //Option
break;
case '21':
irsend.sendRaw(raw17,68,38); //seta baixo tv
break;
case '22':
irsend.sendRaw(raw22,68,38);; //Return tv
break;
case '23':
irsend.sendRaw(raw23,68,38); //Volume+ tv
break;
case '24':
irsend.sendRaw(raw26,68,38); //Canal+ tv
break;
case '25':
irsend.sendRaw(raw24,68,38);; //Volume- tv
break;
case '26':
irsend.sendRaw(raw25,68,38); //mute tv
break;
case '27':
irsend.sendRaw(raw27,68,38);//canal- tv
break;




}


}

alguém sabe porque o arduino está travando??

Exibições: 207

Responder esta

Respostas a este tópico

VC criou muitas variáveis do tipo int consumindo muito de sua memória,o interessante seria utilizar variaveis locais assim  o arduino não precisaria armazenar os valores de cada código utilizando apenas na hora da solicitação

RSS

Destaques

Registre-se no
Lab de Garagem
Clicando aqui

Convide um
amigo para fazer
parte

curso gratis de arduino

© 2018   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço