Problem controling led with infrared (led flashes)

hi i have a small problem with the led i am trying to turn on and off with a remote (it’s is some times flashing!)

first i started a IR-decoder so i now the value off a pressed button but here i finde the fist wired thing
when i press 8 i get 2 value’s the first i only get on time (16730805) and then it keeps repeating the sekund value (4294967295)

after that i use this code

//get started:

// The IR sensor's pins are attached to Arduino as so:
// Pin 1 to Vout (pin 11 on Arduino)
// Pin 2 to GND
// Pin 3 to Vcc (+5v from Arduino)

#include <IRremote.h>

int IRpin = 11;  // pin for the IR sensor
int LED = 8;    // LED pin  
IRrecv irrecv(IRpin);
decode_results results;

boolean LEDon = true; // initializing LEDon as true

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
 pinMode(LED, OUTPUT);
}

void loop()
{
 
 if (irrecv.decode(&results))
   {
     
     irrecv.resume();   // Receive the next value
   }
 
  if (results.value == 16730805)  // change zero to your IR remote button number
    {
      if (LEDon == true)   // is LEDon equal to true?
        {
          LEDon = false;  
          digitalWrite(LED, HIGH);
          delay(1000);      // keeps the transistion smooth
           
        }
       
       else
         {
           LEDon = true;
           digitalWrite(LED, LOW);
           delay(1000);
           
         }
    }

then i test and when i press the 8 on my remote the led turns on, press 8 the led turns off

BUT here is the problem sometimes (one out off 10) instead og just turning on, it’s get stuck in the IF loop and the led begins to flash on and off

i have tryed opping the delay from 100 to 1000 now it’s only one out of 20 times but i am just one of the geeks that can’t live with bugs in the system ^^

After some more testing i know the problem but i can’t fix it!
on pic 1 you see it receives the 16730805, but if that’s the only code it gets it will start to flash
but on pic 2 you see it receives the 16730805 and then 4294967295 over and over and when it gets that the led will stay on

i hope you can help me fix this bug

PIC 1

PIC 2

Please go back and use the "modify" function on your post to mark the code up with "code" tags, not what you have used there.

Paul__B:
Please go back and use the “modify” function on your post to mark the code up with “code” tags, not what you have used there.

how about some help?

and what is the “code” tags? can’t find them, and if I knew what they were, i would have used them

next time give an answer and not more problems, or at least tell me why?

When you post, click the </> button on the toolbar, it will open
[ code ][ /code ] (without the spaces tho)
put your code in the middle of them.
If you forget, you can select More from the bottom right of your message, then Modify, and add them in afterwards.
You can the same for weblinks with url /url, and webpictures with img /img

CrossRoads:
When you post, click the </> button on the toolbar, it will open
[ code ][ /code ] (without the spaces tho)
put your code in the middle of them.
If you forget, you can select More from the bottom right of your message, then Modify, and add them in afterwards.
You can the same for weblinks with url /url, and webpictures with img /img

thx for the help just gonna tak a note of this :slight_smile:

You need to clear the result from the IR after you have read it and taken action on the result.