Has anyone here tried using the PS2 keyboard library with the FastLED library on an Arduino UNO? Separately I can get each library to function properly, but combined FastLED seems to be interfering with my keyboard input.
When I press a key I either get no keyboard echo on the serial monitor or sometimes the correct character but sometimes it displays the wrong character entirely.
I’ve tried moving my LED strip data pin as well as the IRQ & Data pins for the keyboard but so far the combinations I’ve tried haven’t changed the issue.
You haven’t mentioned what LEDs you are using, however if you are using WS2811/WS2812 style leds then this is likely to not work well for you.
Because of the timing requirements of these chipsets, FastLED has to disable interrupts while it is writing out led data. Assuming the PS2 library is run based on interrupts, any keypress data that comes in while led data is being written out will be lost.
Your options are to either switch to a 4-wire, SPI based led chipset (e.g. the APA102 (aka adafruit’s “DotStar” leds), WS2801, or LPD8806) or move to one of the systems that FastLED can play a little bit better w/interrupts like the teensy 3.1 or the arduino due.
Yep, using WS2812 style. Bummer. Would there still be possible interrupt issues using a teensy 3.1 and WS2812 alongside the PS2 library? Or would that change alone make them play nicely together?
On the teensy 3.1 interrupts are allowed. Basically, if the interrupt handler takes too long, the current frame being written out gets cut short (so you’d see leds at the end of the strip not updating) - so at that point it becomes a question of how efficient the interrupt handler in the PS2 library is.
Got it. Thanks for the help!
Interesting. I take it that fastled does not disable interrupts writing to apa102 LEDs?
No it doesn’t have to because the apa102 doesn’t have the timing requirements of the ws2811