Blogger

Delete comment from: Ken Shirriff's blog

Voodenn said...

I just acquired an XBox360 to use as a Media Center Extender with my Microsoft Windows Media Center.

The XBox works with a standard RC6 Media Center Remote.

It works great.

Except: The Volume Up and Down buttons are incapable of changing the volume at the level of the Xbox.
Microsoft wants the user to control volume ONLY at the level of the TV.

I have attempted to make an Arduino soultuin to the problem that will RECEIVE the Volume Up/Down code from mthe RC6, and upon its receipt, "rebroadcast it" AS RCA codes (for my old RCA TV).

Problem:
Although the receive section and the send section of my code work fine SEPARATELY, when I string them together, the program locks up.
Code is attached.

The first press of the remote button gives the desired behavior.
Both the Serial Output, and also the Volume of the TV goes UP.

Subsequent presses do nothing (either to Serial Output or the TV).

Any thoughts on this ?

Thank you.

Bob W.
(code follows)


#include

unsigned int RCAVOLUP[52] =
{
4000 ,4000 ,
550 ,1900 ,550 ,1900 , //11 // F
550 ,1900 ,550 ,1900 , //11
550 ,950 ,550 ,950 , //00 // 2
550 ,1900 ,550 ,950 , //10
550 ,1900 ,550 ,1900 , //11 // F
550 ,1900 ,550 ,1900 , //11
550 ,950 ,550 ,950 , //00 // 0
550 ,950 ,550 ,950 , //00
550 ,1900 ,550 ,1900 , //11 // D
550 ,950 ,550 ,1900 , //01
550 ,950 ,550 ,950 , //00 // 0
550 ,950 ,550 ,950 //00
};

int iReading;

IRsend irsend;


// ** for IR ** //
// Pin 9 VCC
// Pin 10 GND
int RECV_PIN = 11; //11;
IRrecv irrecv(RECV_PIN);
decode_results results;



void setup()
{
/* Set up oins 2-13 as OUTPUT */
for (int i=2; i<=13; i++) pinMode(i, OUTPUT);
for (int i=2; i<=13; i++) digitalWrite(i, LOW);

/* Diagnostic Messages to Serial Monitor */
Serial.begin(9600);
Serial.println("Ready");

/* Demonstrate that Send Codes Work */
irsend.sendRaw(RCAVOLUP,52, 57);
delay(250);
irsend.sendRaw(RCAVOLUP,52, 57);
delay(250);
irsend.sendRaw(RCAVOLUP,52, 57);
delay(250);
irsend.sendRaw(RCAVOLUP,52, 57);
delay(250);
irsend.sendRaw(RCAVOLUP,52, 57);
delay(250);

// ** fSet Up IR Receiver ** //
digitalWrite(9, HIGH); // 9 convenient VCC
digitalWrite(10, LOW); // 10 convenient GND
irrecv.enableIRIn(); // Start the receiver
}


void loop()
{
if (irrecv.decode(&results))
{
/* Get Received Codes and Print to Serial Monitor */
iReading = results.value;
Serial.println(iReading % 0x8000, HEX);

/* If RECEIVED Volume Up coade from RC6 remote, then transmiat RCA Volume Up code */
if ( (iReading % 0x8000 ) == 0x410)
{
irsend.sendRaw(RCAVOLUP,52, 57);
}

/* PROGRAM SEEMS TO LOCK UP HERE !!!!! */

irrecv.resume(); // Receive the next value
}
}

Jun 18, 2012, 3:22:25 PM


Posted to A Multi-Protocol Infrared Remote Library for the Arduino

Google apps
Main menu