how to connect remote control, arduino and kinect ?

following this books “arduino and kinect projects” chapter 5. kinect remote control. by Melger and Diez.
i attach thats books.
it first through creating a bit of code in the Arduino IDE that like hold on button of remote control using relay. when i sent “1” Arduino will sent to pin “5” change the channel. but it can’t works.

The first bit of arduino code looks like this:
// Remote Control

//Use of 4 pins, 2 for channel changes, 2 volume changes
int ChannelPlusPin = 5;
int ChannelLessPin = 6;
int VolumePlusPin = 7;
int VolumeLessPin = 8;

int pulse = 250; // milliseconds to hold button on

void setup()
{
//set up pins as outputs

pinMode(ChannelPlusPin, OUTPUT);
pinMode(ChannelLessPin, OUTPUT);
pinMode(VolumePlusPin, OUTPUT);
pinMode(VolumeLessPin, OUTPUT);

Serial.begin(9600);// Start serial communication at 9600 bps

}

void loop()
{
if (Serial.available()) { // If data is available to read,
char val=Serial.read();

if(val == ‘1’) {
// Channel plus button pulsed
updatePin(ChannelPlusPin, pulse);
} else if(val == ‘2’) {
// Channel less button pulsed
updatePin(ChannelLessPin, pulse);
} else if(val == ‘3’) {
// Volume plus button pulsed
updatePin(VolumePlusPin, pulse);
} else if(val == ‘4’) {
// Volume less button pulsed
updatePin(VolumeLessPin, pulse);
}
}
}

// function for updating any pin

void updatePin (int pin, int pulse){
Serial.print(“RECEIVED PIN”);
Serial.println(pin);
digitalWrite(pin, HIGH);
delayMicroseconds(pulse);
digitalWrite(pin, LOW);
Serial.println(“OFF”);
}

but nothing happens with my television. Can someone point me in the right direction please!

Remote_Control.pde (6.59 KB)

What is connected to pins 5, 6, 7, and 8?

pin 5,6,7,8 connected to prototypeshield.

pin 5,6,7,8 connected to prototypeshield.

Oh, well, then the code should be working. Good luck.

Now, really, WHAT ARE PINS 5 to 8 CONNECTED TO?

The comment and the code does not match:-

int pulse = 250;   // milliseconds to hold button on

And

delayMicroseconds(pulse);

Microseconds and milli seconds are not the same thing.
What does the debug print give you?

Please post the code correctly, read how to use this forum sticky.

PaulS:

pin 5,6,7,8 connected to prototypeshield.

Oh, well, then the code should be working. Good luck.

Now, really, WHAT ARE PINS 5 to 8 CONNECTED TO?

oh, i'm sorry. pin 5 to 8 connected to board remote control. 5 for next channel, 6 previous channel, 7 volume up and 8 volume down.

And the grounds? Are they common?

Grumpy_Mike:
The comment and the code does not match:-

int pulse = 250;   // milliseconds to hold button on

And

delayMicroseconds(pulse);

Microseconds and milli seconds are not the same thing.
What does the debug print give you?

Please post the code correctly, read how to use this forum sticky.

nothing happen with this code. i want to connected remote control and arduino using prototypeshield. but i get error.
yes, i’m newbie. sorry :slight_smile:

Grumpy_Mike:
And the grounds? Are they common?

connection like this picture

What kind of relays? Typically, relays take a fair amount of current to trigger. The Arduino pins can not supply much current.

PaulS:
What kind of relays? Typically, relays take a fair amount of current to trigger. The Arduino pins can not supply much current.

i use relay znd 6vdc. when i connect with my computer i need supply from adaptor too. and program arduino works but when i connect to processing. nothing happen with my tv. maybe i get error in serial communication or what?

First off you need to check the resistance of the relay coil to see if it is greater than 100R, if not you need to drive it with a transistor.
Next the relay coil needs a diode across it to protect the arduino from back EMF.
Can you here the relays click on and off? Write a sketch that simply tests this just like a slow LED blink. This will test your hardware.
Only when that is working should you bother about your input side.