Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save phellipeandrade/866ae4fac9d137e41f35d8822e9c1435 to your computer and use it in GitHub Desktop.

Select an option

Save phellipeandrade/866ae4fac9d137e41f35d8822e9c1435 to your computer and use it in GitHub Desktop.

Revisions

  1. phellipeandrade created this gist Oct 9, 2019.
    208 changes: 208 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,208 @@
    #include <Arduino.h>
    #include <IRremote.h>

    #define onOffReceived 49 // 1
    #define energyRcv 50 // 2
    #define avMode 51 // 3
    #define input 52 // 4
    #define tvRad 53 // 5
    #define list 54 // 6
    #define quickView 55 // 7
    #define volumeUp 56 // 8
    #define volumeDown 57 // 9
    #define programUP 113 // q
    #define programDown 119 // w
    #define guide 101 // e
    #define homeBtn 114 // r
    #define fav 116 // t
    #define ratio 121 // y
    #define mute 117 // u
    #define arrowUp 105 // i
    #define arrowDown 111 // o
    #define arrowLeft 112 // p
    #define arrowRight 97 // a
    #define ok 115 // s
    #define back 100 // d
    #define info 102 // f
    #define exit 103 // g
    #define redBttn 104 // h
    #define greenBttn 106 // j
    #define yellowBttn 107 // k
    #define blueBttn 108 // l
    #define text 122 // z
    #define tOpt 120 // x
    #define subtitle 99 // c
    #define stopBttn 118 // v
    #define playBttn 98 // b
    #define pause 110 // n
    #define rew 109 // m
    #define forward 44 // ,
    #define ad 46 // .


    IRsend irsend;

    static int cero=0;
    long unsigned int irCode;

    int cmdReceived;

    void setup(){
    Serial.begin(9600);
    }

    void loop(){
    if(Serial.available()>0){
    int cmdReceived=Serial.read();

    // say what you got:
    Serial.print("I received: ");
    Serial.println(cmdReceived);

    switch(cmdReceived){
    case onOffReceived:
    irCode=0x20DF10EF;
    break;
    case energyRcv:
    irCode=0x20DFA956;
    break;
    case avMode:
    irCode=0x20DF0CF3;
    break;
    case input:
    irCode=0x20DFD02F;
    break;
    case tvRad:
    irCode=0x20DF0FF0;
    break;
    case list:
    irCode=0x20DFCA35;
    break;
    case quickView:
    irCode=0x20DF58A7;
    break;
    case volumeUp:
    irCode=0x20DF40BF;
    break;
    case volumeDown:
    irCode=0x20DFC03F;
    break;
    case programUP:
    irCode=0x20DF00FF;
    break;
    case programDown:
    irCode=0x20DF807F;
    break;
    case guide:
    irCode=0x20DFD52A;
    break;
    case homeBtn:
    irCode=0x20DFC23D;
    break;
    case fav:
    irCode=0x20DF7887;
    break;
    case ratio:
    irCode=0x20DF9E61;
    break;
    case mute:
    irCode=0x20DF906F;
    break;
    case arrowUp:
    irCode=0x20DF02FD;
    break;
    case arrowDown:
    irCode=0x20DF827D;
    break;
    case arrowLeft:
    irCode=0x20DFE01F;
    break;
    case arrowRight:
    irCode=0x20DF609F;
    break;
    case ok:
    irCode=0x20DF22DD;
    break;
    case back:
    irCode=0x20DF14EB;
    break;
    case info:
    irCode=0x20DF55AA;
    break;
    case exit:
    irCode=0x20DFDA25;
    break;
    case redBttn:
    irCode=0x20DF4EB1;
    break;
    case greenBttn:
    irCode=0x20DF8E71;
    break;
    case yellowBttn:
    irCode=0x20DFC639;
    break;
    case blueBttn:
    irCode=0x20DF8679;
    break;
    case text:
    irCode=0x20DF04FB;
    break;
    case tOpt:
    irCode=0x20DF847B;
    break;
    case subtitle:
    irCode=0x20DF9C63;
    break;
    case stopBttn:
    irCode=0x20DF8D72;
    break;
    case playBttn:
    irCode=0x20DF0DF2;
    break;
    case pause:
    irCode=0x20DF5DA2;
    break;
    case rew:
    irCode=0x20DFF10E;
    break;
    case forward:
    irCode=0x20DF718E;
    break;
    case ad:
    irCode=0x20DF8976;
    break;
    case 0:
    irCode=0x20DF08F7;
    break;
    case 1:
    irCode=0x20DF8877;
    break;
    case 2:
    irCode=0x20DF48B7;
    break;
    case 3:
    irCode=0x20DFC837;
    break;
    case 4:
    irCode=0x20DF28D7;
    break;
    case 5:
    irCode=0x20DFA857;
    break;
    case 6:
    irCode=0x20DF6897;
    break;
    case 7:
    irCode=0x20DFE817;
    break;
    case 8:
    irCode=0x20DF18E7;
    break;
    case 9:
    irCode=0x20DF9867;
    break;
    }
    irsend.sendNEC(irCode,32);
    }
    }