//ONLY EVEN TV CHANNELS
// If they hit channel up, the arduino will hit it again.
// Channel down will also be repeated.
//You will need the IR library, and IR led, and an IR receiver.
// the IR LED goes on digital pin 3. Use a 100 ohm resistor before it.
// the IR receiver goes to pin 11
// If your channel numbers are different then use the key below to
// enter in the correct channel numbers.
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
unsigned long inputValue;
/*
INPUT codeValue KEY (for Phillips)
Every button has 2 possible values. Each one works.
CHANNEL UP = 32 or 2080
CHANNEL DOWN = 33 or 2081
VOL UP= 16, 2064
VOL DOWN= 17, 2065
1= 1, 2049
2= 2, 2050
3= 3, 2051
4= 4, 2052
5= 5, 2053
6= 6, 2054
7= 7, 2055
8= 8, 2056
9= 9, 2057
0= 0, 2048
POWER= 12, 2060
MUTE= 13, 2061
MENU= 59, 2107
STATUS= 15, 2063
*/
/*
OUTPUT CODE VALUE KEY (for Phillips)
CHANNEL UP = 20 or 820
CHANNEL DOWN = 21 or 821
VOL UP= 10 or 810
VOL DOWN= 11 or 811
1= 1 or 801 etc.
2= 2, 802
3= 3, 803
4= 4, 804
5= 5, 805
6= 6, 806
7= 7, 807
8= 8, 808
9= 9, 809
0= 0, 800
MUTE = 80D or D
POWER= 80C, C
MENU= 83B, B
STATUS= 80F, F
*/
//-------------------------------------------
//ONLY EVEN TV CHANNELS
if (irrecv.decode(&results) ) {
// Serial.println (results.value, HEX) ;
inputValue = results.value;
Serial.println(inputValue); //You can see the input values for yourself, key is above
if (inputValue == 32 || inputValue == 2080){ // if they hit Channel Up
delay(800);
irsend.sendRC5(0x20, 12); // 820 is the Channel Up Output code
delay(800);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue == 33 || inputValue == 2081){ // if they hit Channel Down
delay(800);
irsend.sendRC5(0x21, 12); // 821 is the Channel Down Output code
delay(800);
irrecv.enableIRIn(); //enable the IR receiver again
}
irrecv.resume(); // Receive the next value
}
delay(10);
}
//CAN'T TURN OFF THE TV
//Once they turn on the TV, they are unable to turn it back off.
// When they turn on the TV the program is activated.
// If they turn the TV off by remote the arduino will turn
// the TV back on.
//You will need the IR library, and IR led, and an IR receiver.
// the IR LED goes on digital pin 3. Use a 100 ohm resistor before it.
// the IR receiver goes to pin 11. Use a 220 resistor before it.
// If your channel numbers are different then use the key below to
// enter in the correct channel numbers.
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
int ProgramBegin = 0;
int trigger = 0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
unsigned long inputValue;
/*
INPUT codeValue KEY (for Magnavox)
Every button has 2 possible values. Each one works.
CHANNEL UP = 32 or 2080
CHANNEL DOWN = 33 or 2081
VOL UP= 16, 2064
VOL DOWN= 17, 2065
1= 1, 2049
2= 2, 2050
3= 3, 2051
4= 4, 2052
5= 5, 2053
6= 6, 2054
7= 7, 2055
8= 8, 2056
9= 9, 2057
0= 0, 2048
POWER= 12, 2060
MUTE= 13, 2061
MENU= 59, 2107
STATUS= 15, 2063
*/
/*
OUTPUT CODE VALUE KEY (for Magnavox)
CHANNEL UP = 20 or 820
CHANNEL DOWN = 21 or 821 etc.
VOL UP= 10
VOL DOWN= 11
1= 1 or 801 etc.
2= 2, 802
3= 3, 803
4= 4, 804
5= 5, 805
6= 6, 806
7= 7, 807
8= 8, 808
9= 9, 809
0= 0, 800
MUTE = 80D or D
POWER= 80C, C
MENU= 83B, B
STATUS= 80F, F
*/
//-------------------------------------------
//CAN'T TURN OFF THE TV!
if (irrecv.decode(&results) ) {
// Serial.println (results.value, HEX) ;
inputValue = results.value;
Serial.println(inputValue); //You can see the input values for yourself, key is above
if (trigger == 0){
if (inputValue == 12 || inputValue == 2060){ //They turn the TV on, begin the program
trigger = 1;
ProgramBegin = 1;
Serial.println("Hello");
delay(5000);
inputValue = 0;
}
}
if (ProgramBegin == 1){
if (inputValue == 12 || inputValue == 2060){ //They turn the TV off
Serial.println("Activated!");
delay (2000); // Wait for it...
// Turn the TV back on!
irsend.sendRC5(0x80C, 12); // 80C is the Power Output code
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
}
irrecv.resume(); // Receive the next value
}
delay(10);
}
// YOU CAN ONLY WATCH C-SPAN
// when someone turns the power on, it turns the channel to C-span
// if they hit channel up, the arduino will hit channel down
// if they hit channel down, then back up
// if they type in a number, the arduino waits 5 seconds, then types back in C-span
//You will need the IR library, and IR led, and an IR receiver.
// the IR LED goes on digital pin 3. Use a 100 ohm resistor before it.
// the IR receiver goes to pin 11. Use a 220 resistor before it.
// If your channel numbers are different then use the key below to
// enter in the correct channel numbers.
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
int i = 0;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
unsigned long inputValue;
/*
INPUT codeValue KEY (for Magnavox)
Every button has 2 possible values. Each one works.
CHANNEL UP = 32 or 2080
CHANNEL DOWN = 33 or 2081
VOL UP= 16, 2064
VOL DOWN= 17, 2065
1= 1, 2049
2= 2, 2050
3= 3, 2051
4= 4, 2052
5= 5, 2053
6= 6, 2054
7= 7, 2055
8= 8, 2056
9= 9, 2057
0= 0, 2048
POWER= 12, 2060
MUTE= 13, 2061
MENU= 59, 2107
STATUS= 15, 2063
*/
/*
OUTPUT CODE VALUE KEY (for Magnavox)
CHANNEL UP = 20 or 820
CHANNEL DOWN = 21 or 821 etc.
VOL UP= 10
VOL DOWN= 11
1= 1 or 801 etc.
2= 2, 802
3= 3, 803
4= 4, 804
5= 5, 805
6= 6, 806
7= 7, 807
8= 8, 808
9= 9, 809
0= 0, 800
MUTE = 80D or D
POWER= 80C, C
MENU= 83B, B
STATUS= 80F, F
*/
//-------------------------------------------
if (irrecv.decode(&results) ) {
// Serial.println (results.value, HEX) ;
inputValue = results.value;
Serial.println(inputValue); //You can see the input values for yourself, key is above
if (inputValue == 12 || inputValue == 2060){ //They turn the TV on
delay(2000); // wait 2 seconds
// turn it to C-span
irsend.sendRC5(0x803, 12); // OUTPUT 3
delay(400);
irsend.sendRC5(0x3, 12); // OUTPUT 3
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue == 32 || inputValue == 2080){ // if they hit Channel Up
delay(200);
irsend.sendRC5(0x821, 12); // enter Channel Down
delay(200);
irrecv.enableIRIn(); //enable the IR receiver again
Serial.println("Hello");
}
if (inputValue == 33 || inputValue == 2081){ // if they hit Channel Down
delay(200);
irsend.sendRC5(0x820, 12); // enter Channel Up
delay(200);
irrecv.enableIRIn(); //enable the IR receiver again
}
// If they type in a Number it will wait 5 seconds, then enter C-span
if (inputValue <= 9 && inputValue > 0 ){
delay (5000); //wait 5 seconds
// then turn it to C-span
irsend.sendRC5(0x803, 12); // OUTPUT 3
delay(400);
irsend.sendRC5(0x3, 12); // OUTPUT 3
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue >= 2048 && inputValue <= 2057){ // this is a duplicate because each
//digit has more than one input value, (could be 9 or 2057 for digit 9)
delay (5000); //wait 5 seconds
// then turn it to C-span
irsend.sendRC5(0x803, 12); // OUTPUT 3
delay(200);
irsend.sendRC5(0x3, 12); // OUTPUT 3
delay(200);
irrecv.enableIRIn(); //enable the IR receiver again
}
irrecv.resume(); // Receive the next value
}
delay(10);
}