sir i did edit my code as u say but its not working.
please help me please please please.........
now my code is look like this. sorry for my poor english.
#include <IRLib.h>
int GreenLed = 7;
int RedLed = 10;
int GreenLedState = 0;
int RedLedState = 0;
#define REMOTE_KEY_1 0x20DF8877 //remote key 1
#define REMOTE_KEY_2 0x20DF48B7 //remote key 2
IRrecv My_Receiver(11);//receiver on pin 11
IRdecode My_Decoder; //Decoder object
long GreenLedoffAt = 0;
long RedLedoffAt = 0;
void setup() {
Serial.begin(9600);
My_Receiver.enableIRIn(); // Start the receiver
pinMode(GreenLed, OUTPUT);
digitalWrite(GreenLed, LOW);
pinMode(RedLed, OUTPUT);
digitalWrite(RedLed, LOW);
delay(1000);
}
void loop()
{
Serial.println(My_Decoder.value, HEX);
if (My_Receiver.GetResults(&My_Decoder)) {
My_Decoder.decode();
if (My_Decoder.decode_type == NEC) {
Serial.println(My_Decoder.value, HEX);
if (My_Decoder.value == REMOTE_KEY_1)
{
digitalWrite(GreenLed, HIGH);
GreenLedoffAt = millis() + 100; // Set the time-out
GreenLedState = 1;
Serial.print("Green Led on");
}
else if (My_Decoder.value == REPEAT && GreenLedState == 1)
{
GreenLedoffAt = millis() + 100; // update the time-out
}
}
My_Receiver.resume(); //Restart the receiver
}
if(digitalRead(GreenLed) == HIGH){
if(millis() >= GreenLedoffAt){
digitalWrite(GreenLed, LOW);
GreenLedState = 0;
if (My_Decoder.value == REMOTE_KEY_2) // Yadi remote ka 1 number press kiya hai then
{
digitalWrite(RedLed, HIGH);
RedLedoffAt = millis() + 100; // Set the time-out
RedLedState = 1;
Serial.print("Green Led on");
}
else if (My_Decoder.value == REPEAT && RedLedState == 1)
{
RedLedoffAt = millis() + 100; // update the time-out
}
}
My_Receiver.resume(); //Restart the receiver
}
// Turn off relay...
if(digitalRead(RedLed) == HIGH){ //yadi TimerLed is samay on hai aur
if(millis() >= RedLedoffAt){
digitalWrite(RedLed, LOW);
RedLedState = 0;
}
}
}