Basically, you can’t reliably use an IR controller with Neopixel animations; this is a shortcoming of the Neopixels themselves. They require interrupts to be turned off, which also disables receiving IR codes.
Try using APA102 (“Dotstar”) LEDs instead, as they don’t have this problem.
I wish there were better answers!
(It will work ok if you’re not animating the pixels… only changing them at all after an IR signal is received.)
I use the IRremote library and FastLED library with WS2811 LEDs with the clock that I built a while back to my satisfaction.
I find the trick is to flush (simply discard) any received IR data while data is transmitted to the LEDs as that is likely to have been corrupted.
Then I halt all ‘continuous’ LED action and take on the ‘stable’ IR data and then resume only after all valid IR data transmission is completed. You can then modify the sketch and LED animation based on that IR data.
Hi @michael_valberg , I am not sure if you commented my answer or another but here’s a link to that clock I built that uses the IRremote and FastLED on a Arduino MEGA… https://plus.google.com/106626345342202981932/posts/SM62KcSTgon
You can see in the video that I control the clock with a small IR transmitter. Note that the IR receiver is mounted such that it is pointing backwards as normally the IR signal would bounce off the wall behind the clock. In this video, I positioned the clock on the floor and the IR transmitter has a hard time reaching the receiver but still works !
@JP_Roy Hi, I’m working on this issue with the remote control, too. Sorry JP Roy but I do not understand your solution at all, could you post a small example how you fix the issue between FastLED and IRRemote - thanks -
Hi @Bernd_Klein , I will not post the actual code I use as it is very big and most of it would be totally irrelevant to anybody but me as it applies to a very unique clock that I built.
Did you look at the short video on that link… https://plus.google.com/106626345342202981932/posts/SM62KcSTgon
It show how it works !
Basically, the clock is always running (that is very normal for a clock!) and LEDS are continuously updated. In my loop, at the very beginning I check to see if my IRreceiver got anything with the following line…
if (irrecv.decode(&results)) checkIRcodes();
It does not matter to me if I receive garbage info at this point as I will skip out of the normal loop and enter the checkIRcodes() function that I created.
In that function, I stop all continuous LED update completely and simply wait there until I get valid IR data. Stopping continuous LED updates is necessary to prevent IR data corruption. These are the 2 lines that I use to do this…
irrecv.resume(); // Receive the next value
while (! irrecv.decode(&results)) {} // just sit there waiting for another IR transmitter key press.
When some IR data is received and decoded, you can use that info and update variables etc… etc… I use a specific IR transmitter key press to indicate the end of IR data transmission and exit the checkIRcodes() function and return to the normal loop and clock operation with it’s continuous LED updating
For that part, I use something very similar to the code initially posted by michael Valberg.
I hope this clarifies things for you otherwise do come back with any specific questions.