#include <IRremote.h>//includes IR library
 
int RECV_PIN = 11; //IR input
int Wire1 = 7;                   // Pin 7 used for relay
int Wire2 = 6;                   // Pin 6 used for relay
int powerPin= 5;                    // pin 5 used for relay
 
int powerState = 0; // 0 is off 1 is on
 
IRrecv irrecv(RECV_PIN);
 
decode_results results;
 
void setup()
{
  irrecv.enableIRIn(); // Start the receiver
  pinMode(Wire1, OUTPUT);        // declare pin 7 to be an output
  pinMode(Wire2, OUTPUT);        // declare pin 6 to be an output
  pinMode(powerPin, OUTPUT);         // declares pin 5 as an output
}
 
void loop() 
{
  if (irrecv.decode(&results)) //revieves IR info
  {
    irrecv.resume(); // Receive the next value
  }
  delay(100);//delays 100 miliseconds
 
  if (results.value == 31377463)//if power button is hit then do the following
  {
       powerState = (powerState == 0 ? 1:0);
  }
 
  if (powerState == 1)
    {
         digitalWrite(Wire1,HIGH);//turn on wire 1
         digitalWrite(Wire2,HIGH);//turn on wire 2
     } else {
         digitalWrite(Wire1,LOW);//turn off wire 1
         digitalWrite(Wire2,LOW);//turn off wire 2
    }
 
  delay(100); //delays 250 milliseconds and waits for next command
 
}