Advertisement
fabiocftv

Arduino 2 receptor

Sep 25th, 2016
2,717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void recebeir(){
  2.   char valorlido = Serial.read();
  3.  
  4.     //liga-desliga
  5. const unsigned int S_pwr[68]={4600,4350,700,1550,650,1550,650,1600,650,450,650,450,650,450,650,450,700,400,700,1550,650,1550,650,1600,650,450,650,450,650,450,700,450,650,450,650,450,650,1550,700,450,650,450,650,450,650,450,650,450,700,400,650,1600,650,450,650,1550,650,1600,650,1550,650,1550,700,1550,650,1550,650};
  6. // channel up
  7. const unsigned int S_pup[68]={4600,4350,700,1500,700,1500,700,1550,700,450,650,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,450,650,450,700,400,700,400,700,400,700,400,700,1550,700,400,700,400,700,1550,650,450,700,400,700,400,700,1550,650,450,650,1600,650,1550,650,450,700,1500,700,1500,700,1550,650};
  8. // channel down
  9. const unsigned int S_pdown[68]={4650,4300,700,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,650,450,650,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,700,400,700,400,700,400,700,450,650,450,650,1550,700,400,700,450,650,400,700,1550,700,1500,700,1550,700,1500,700,400,700,1550,650,1550,700,1500,700};
  10. // volume up
  11. const unsigned int S_vup[68]={4600,4350,650,1550,700,1500,700,1550,700,400,700,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,400,700,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,400,700,450,700,400,700,400,700,400,700,450,650,450,650,450,650,1550,700,1500,700,1550,700,1500,700,1550,650};
  12. // volume down
  13. const unsigned int S_vdown[68]={4600,4350,700,1550,650,1550,700,1500,700,450,650,450,700,400,700,400,700,400,700,1550,700,1500,700,1550,700,400,700,400,700,400,700,450,650,450,650,1550,700,1500,700,450,650,1550,700,400,700,400,700,450,700,400,700,400,700,400,700,1550,700,400,700,1500,700,1500,700,1550,700,1500,700};
  14. // mute
  15. const unsigned int S_mute[68]={4650,4350,650,1550,650,1550,700,1550,700,400,700,400,700,400,700,450,650,450,650,1550,700,1500,700,1550,700,400,700,450,650,400,700,450,700,400,700,1500,700,1550,650,1550,700,1500,700,450,700,400,700,400,700,400,700,400,700,450,650,450,700,400,700,1500,700,1550,650,1550,700,1500,700};
  16. // source
  17. const unsigned int S_scr[68]={4600,4350,700,1550,650,1550,700,1500,700,450,650,450,700,400,700,400,700,400,700,1550,700,1500,700,1550,700,400,700,400,700,400,700,400,700,400,700,1550,700,400,700,450,650,450,650,450,700,400,700,400,700,400,700,450,650,1550,700,1500,700,1550,650,1550,700,1500,700,1550,700,1500,700};
  18.  
  19.  
  20.     if (valorlido == 'O'){ //liga ou desliga a tv
  21.   {
  22.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  23.   irsend.sendRaw(S_pwr,68,38); //código clonado
  24.   delay(52);
  25.   }
  26.   Serial.println("Liguei ou Desliguei a TV");
  27.   }
  28.  
  29.     else  if (valorlido == 'W'){ //Muda o canal para o canal acima
  30.   {
  31.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  32.   irsend.sendRaw(S_pup,68,38); //código clonado
  33.   delay(52);
  34.   }
  35.   Serial.println("Canal +");
  36.   }
  37.  
  38.    else  if (valorlido == 'K'){ //Muda o canal para o canal abaixo
  39.   {
  40.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  41.   irsend.sendRaw(S_pup,68,38); //código clonado
  42.   delay(52);
  43.   }
  44.   Serial.println("Canal -");
  45.   }
  46.  
  47.     else  if (valorlido == 'Y'){ //Aumenta o Volume da TV
  48.   {
  49.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  50.   irsend.sendRaw(S_vup,68,38); //código clonado
  51.   delay(52);
  52.   }
  53.   Serial.println("Volume +");
  54.   }
  55.  
  56.  
  57.       else  if (valorlido == 'Q'){ //Abaixa o Volume da TV
  58.   {
  59.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  60.   irsend.sendRaw(S_vdown,68,38); //código clonado
  61.   delay(52);
  62.   }
  63.   Serial.println("Volume -");
  64.   }
  65.     else  if (valorlido == 'M'){ //Deixa o Volume no Mudo
  66.   {
  67.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  68.   irsend.sendRaw(S_mute,68,38); //código clonado
  69.   delay(52);
  70.   }
  71.   Serial.println("Mudo");
  72.   }
  73.      else  if (valorlido == 'Z'){ //Acessa o source
  74.   {
  75.   for (int i = 0; i < 1; i++) //Envia um flash de led com 3 comandos
  76.   irsend.sendRaw(S_scr,68,38); //código clonado
  77.   delay(52);
  78.   }
  79.   Serial.println("Source");
  80.   }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement