Go Down

Topic: Problem with ir remote library and pwm pins (Read 707 times) previous topic - next topic


Feb 03, 2013, 07:40 am Last Edit: Feb 09, 2013, 09:02 pm by shihtin Reason: 1
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..
Code: [Select]

#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()

void loop()
 x = ir_check();
 pwm_write (x);

int ir_check()
 if (irrecv.decode(&results))
   if (results.value==2060 || results.value==12)

 return i;

void pwm_write (int x)
 if (x<10)
   value = x*24;
  /* digitalWrite(pwm_signal,HIGH);



Nick Gammon

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.

Nick Gammon

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.

Go Up