relay shield and breakouts?

So I've seen very little info on the relay shields and maybe that is because this is so simple to use but I wouldn't know. So I've seen the example that switches the relay from nc to no on a timer, but while a timer is useful in some situations I wanted to use a tv remote or the ir feature on my android to activate the relay and Im having a hard time thinking up a code that would work. Am I going to have the arduino constantly checking the state of the ir sensor during the loop possibly? This seems like it may work but would be very inefficient at best and there has got to be a better way right? Any thoughts on this would be greatly appreciated. I'm still new to the microcontroller/programming world and would love some thoughts from someone that has done this before. Thank you very much. One last thing... I did post this in the right area didn't i?

Am I going to have the arduino constantly checking the state of the ir sensor during the loop

That is how it is done. Not inefficient al all. It is called polling an input.

I did post this in the right area didn't i?

Yes.

Have you read the how to use this forum sticky. There is some good advice on how to get the most from the forum as well as guidelines on how to post code to the forum.

Thank you very much! I wasn’t sure if I was going about it correctly or on the right path. I guess sometimes the simple answer just seems like it’s going to be wrong. Will I need an interrupt for the loop function or will an if command do the trick since the loop function is checking the state of the ir sensor?

Here is a simple sketch using the IRremote library to demonstrate turning the onboard LED om and off using an IR remote control and a IR receiver/decoder. This could easily be changed to actuate a relay. You will need to find the values for your remote buttons and change the defines.

#include <IRremote.h>

#define upArrow 0x4eb322dd
#define downArrow 0x4eb3b847

const byte RECV_PIN = 4;
const byte ledPin = 13;


IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
   Serial.begin(9600);
   pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, LOW);
   irrecv.enableIRIn(); // Start the receiver
   Serial.println("Enabled IRin");
}

void loop()
{
   if (irrecv.decode(&results))
   {
      Serial.println(results.value, HEX);
      irrecv.resume(); // Receive the next value
      if (results.value == upArrow)
      {
         digitalWrite(ledPin, HIGH); // led on
      }
      else if (results.value == downArrow)
      {
         digitalWrite(ledPin, LOW); // led off
      }
   }
}