Problem with ir remote library and pwm pins

Hello,
I am a newbie in arduino. I want to control the brightness of the led using ir remote. But this doesn't work. I am using irremote.h library.

I think the problem is related to timers. What I have to do???

The code is given below..

#include <IRremote.h>

int ir_pin = 3;
int pwm_signal=11;
int value;
int x;
int i = 0;
unsigned long start;
unsigned long stp;

IRrecv irrecv (ir_pin);
decode_results results;

void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn();
 pinMode(pwm_signal,OUTPUT);
  
}

void loop()
{
  x = ir_check();
  pwm_write (x);
 Serial.println(x); 
}

int ir_check()
{
  if (irrecv.decode(&results))
  {
    if (results.value==2060 || results.value==12)
    {
      Serial.println("on");
      i++;
    }
    irrecv.resume();
  }
 
  return i;
}

void pwm_write (int x)
{
  if (x<10)
  {
    value = x*24;
  }   
   /* digitalWrite(pwm_signal,HIGH);
    delayMicroseconds(value);
    digitalWrite(pwm_signal,LOW);
    delayMicroseconds(1000-value);*/
   analogWrite(pwm_signal,value);
  
 
}

Read this before posting a programming question

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.

Thanks for the information... can you give any solution?. I am using arduino dueminalove.

What does your debugging display tell you?

Perhaps put in more serial prints to confirm what values you have in your variables.

It work well till first key is pressed on irremote. After that both ir and pwm functions remains in previous condition. I think the problem is related to the timer of the arduino dueminalove. ie, both ir library and analogWrite function uses the same library. I tried to change the timer used in ir library but it can't create any difference.