Skip to content

Instantly share code, notes, and snippets.

@francis2110
Created January 23, 2015 10:32
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save francis2110/f04237b04c94218028e3 to your computer and use it in GitHub Desktop.
Save francis2110/f04237b04c94218028e3 to your computer and use it in GitHub Desktop.
application for send infrared codes to LG tv with arduino
#include <IRremote.h>
IRsend irsend;
#define onOffReceived 10
#define energyRcv 11
#define avMode 12
#define input 13
#define tvRad 14
#define list 15
#define quickView 16
#define volumeUp 17
#define volumeDown 18
#define programUP 19
#define programDown 20
#define guide 21
#define homeBtn 22
#define fav 23
#define ratio 24
#define mute 25
#define arrowUp 26
#define arrowDown 27
#define arrowLeft 28
#define arrowRight 29
#define ok 30
#define back 31
#define info 32
#define exit 33
#define redBttn 34
#define greenBttn 35
#define yellowBttn 36
#define blueBttn 37
#define text 38
#define tOpt 39
#define subtitle 40
#define stopBttn 41
#define playBttn 42
#define pause 43
#define rew 44
#define forward 45
#define ad 46
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();
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment