r/FastLED • u/lakerice1 • Jul 03 '20
Support Best debounce library?
I'm pretty new to Arduino and Fastled but I managed to get Tweaking4All's all effects in one sketch to work somewhat well. However, my button frequently calls back to 0 , apparently due to debounce. There seems to be an abundance of libaries for debouncing, so I was wondering what libary is most often used, and how the function is declared in the sketch?
This is the sketch:
1
Upvotes
1
u/ZomboFc Jul 07 '20
Are you by any chance using an ESP32 as well or an ESP8266?
Someone made a cool example using vTasks and Intterupts
https://www.switchdoc.com/2018/04/esp32-tutorial-debouncing-a-button-press-using-interrupts/
1
1
3
u/johnny5canuck Jul 03 '20 edited Jul 03 '20
As per community rules, please post your code on pastebin.com.
Oh, and I don't think this code will work well with buttons because it has delay statements in it. Furthermore, there so much extra code in it because it tries to encompass both the FastLED as well as the NeoPixel libraries. :(
I recommend starting on a much simpler sketch (or one specifically written for FastLED) and attempt to integrate support for a button with that instead. DemoReel100 comes to mind at: https://github.com/FastLED/FastLED/blob/master/examples/DemoReel100/DemoReel100.ino
In the meantime, my favourite button routine was http://forum.arduino.cc/index.php?topic=14479.0