hello all,
I want to test and learn about IR,
I found this libary IRremote in most posts in this forum all say this is very good libary i try to use it but
when recive work ok and only stop if i use any delay function
here is my code
#include <IRremote.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600) ;
Serial.println("IR code reception") ;
irrecv.enableIRIn(); // Start the ir receiver
}
void loop()
{
if (irrecv.decode(&results)) {
Serial.println(results.value, DEC);
if(results.value == 33489151)
{
digitalWrite(10, HIGH);
delay(500);
digitalWrite(10, LOW);
}
irrecv.resume(); // Receive the next value
}
}
when i run it all ok but stop in case
if(results.value == 33489151)
{
digitalWrite(10, HIGH);
delay(500);
digitalWrite(10, LOW);
}
when in removed the
delay(500);
digitalWrite(10, LOW);
work good but only when i press the button,
what's is the wrong in my code
thank you so much