I went home and had a couple issues but here is the final code that worked perfectly. I will be making a final version without the two leds so it just controls the leds. They were only there for testing purposes but now i am working on the final copy. I will be starting another project today and hope to finish it by the end of the weekend. It will have to do with IR control of a motor. Look for my thread in the forums if youre interested.
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 0;
int RELAY_PIN = 1;
int LED_PIN = 2;
int BLINK_PIN = 4;
int ON_TIME = 10000;
bool signal_on = 0;
bool led_on = 0;
unsigned long previousMillis = 0;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode(RELAY_PIN, OUTPUT);
pinMode(LED_PIN, OUTPUT);
pinMode(BLINK_PIN, OUTPUT);
pinMode(RECV_PIN, INPUT);
irrecv.enableIRIn();
digitalWrite(RELAY_PIN, LOW);
digitalWrite(LED_PIN, LOW);
digitalWrite(BLINK_PIN, LOW);
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= 250) {
previousMillis = currentMillis;
led_on = !led_on;
digitalWrite(BLINK_PIN, led_on);
}
if (irrecv.decode(&results)) {
signal_on = !signal_on;
digitalWrite(RELAY_PIN, signal_on ? HIGH : LOW);
digitalWrite(LED_PIN, signal_on ? HIGH : LOW);
irrecv.resume();
}
}