// VOLUME -B- GONE
// The arduino keeps the TV muted
// 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 ohm 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 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 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
*/
//-------------------------------------------
//Volume -B- Gone
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 someone presses Volume up then the Arduino will hit Mute!
if (inputValue == 16 || inputValue == 2064){ //INPUT volume up
delay(800);
irsend.sendRC5(0x80D, 12); // 80D is the Mute OUTPUT code
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
// If someone presses Volume Down it also hits MUTE
if (inputValue == 17|| inputValue== 2065){ //INPUT volume down
delay(800);
irsend.sendRC5(0xD, 12); // 80D is the Mute OUTPUT code
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
//If someone hits mute to cancel it out, the Arudino will re-send mute.
if (inputValue == 13 || inputValue == 2061){ //INPUT Mute
delay(800);
irsend.sendRC5(0x80D, 12); // 80D is the Mute OUTPUT code
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
irrecv.resume(); // Receive the next value
}
delay(10);
}
// LOUD TV, CAN'T TURN IT DOWN!
// Pressing Channel Up or Down increases the volume.
// if they press volume down, the volume is pressed back up one notch higher
// if they press mute, it will be un-muted
//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 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 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
*/
//-------------------------------------------
//LOUD 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 (inputValue == 32 || inputValue == 2080){ // if they hit Channel Up
delay(800);
irsend.sendRC5(0x810, 12); // 810 is the Volume Up Output code
delay(400);
irsend.sendRC5(0x10, 12); // 10 is also the Volume Up Output code, Volume has gone up by 2
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue == 33 || inputValue == 2081){ // if they hit Channel Down
delay(800);
irsend.sendRC5(0x10, 12); // 10 is also the Volume Up Output code
delay(400);
irsend.sendRC5(0x810, 12); // 810 is also the Volume Up Output code, Volume has gone up by 2
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue == 17 || inputValue == 2065){ // if they hit Volume down
delay(400);
irsend.sendRC5(0x10, 12); // 10 the Volume Up Output code
delay(400);
irsend.sendRC5(0x810, 12); // 810 is also the Volume Up Output code, Volume has gone up by 2
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
if (inputValue == 13 || inputValue == 2061){ // if they hit Mute
delay(800);
irsend.sendRC5(0x10, 12); // 10 is also the Volume Up Output code
delay(400);
irsend.sendRC5(0x810, 12); // 810 is also the Volume Up Output code, Volume has gone up by 2
delay(400);
irrecv.enableIRIn(); //enable the IR receiver again
}
irrecv.resume(); // Receive the next value
}
delay(10);
}
//SLOWLY DISAPPEARING VOLUME
//Once every 2 minutes the arduino will lower the volume 2 notches
//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.
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
int i = 0;
unsigned long time1;
unsigned long time2;
int var = 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
*/
//-------------------------------------------
//You don't need the receiver for this one.
// 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 (var == 0){ //start it
time1 = millis();
var = 1;
}
time2 = millis();
//Serial.println(time2 - time1);
if (time2 - time1 > 180000){ //if 2 minutes have passed
Serial.println("Volume Down");
time1 = time2; //reset the timer
delay(400);
irsend.sendRC5(0x811, 12); // 811 is volume down Output code
delay(400);
irsend.sendRC5(0x11, 12); // 11 is also a volume down Output code
delay(400);
//irrecv.enableIRIn(); //enable the IR receiver again, don't need it
}
//irrecv.resume(); // Receive the next value, don't need it for this prank
// }
delay(10);
}