Junk Number Problem Using IR Remote Control with FastLed and NeoPixels
I am trying to use an IR remote controller with FastLED and NeoPixels in a sketch. Many times on the first button push, I get a junk value, i.e. not the expected value, for that button and nothing happens. When this occurs, each junk value is a different value. When I push the same or another button again right after the junk value, it works. Here is a simple test sketch that illustrates that problem:
I have read @Marc_MERLIN ’s great blog and code but I feel that I am overlooking a key aspect of it.
I am unable to solve my problem after trying many different attempts to solve this problem. These attempts include running it on a Teensy 3.1, on a Teensy 3.6 and on a Lolin D32 using the latest versions of FastLED and IRremote.h along with the Arduino 1.8.7 IDE and the Teensyduino 1.44 for the Teensy MCUs. I have tried different IR remote controllers.
This problem could be due to interrupts with the NeoPixels or with the IRremote.h library but using various code modifications has not worked.
Any advice or help on how to solve this problem would be greatly appreciated so that I can solve this problem and post the video and the code of a much more complex sketch using IR control.