Hans asked me to post this here. I made a couple gifts for the grandkids and I used his great code:
Unfortunately, the momentary on push-button switches I purchased electrically "bounced", which caused problems moving through the various effects. I began by placing this code into his sketch:
void changeEffect() {
if ((digitalRead (BUTTON) == LOW) and (millis() > 200)) {
selectedEffect++;
EEPROM.put(0, selectedEffect);
asm volatile (” jmp 0″);
}
}
This changes the BUTTON function to look for a LOW instead of high, and adds a slight delay of 200 milliseconds. This code worked just fine, but I also took a step further and replaced the mechanical pushbutton with one of these:
ALAMSCN 20PCS TTP223 Capacitive Touch Switch Button Sensor Module Self Locking for Arduino
Here's an Amazon link for North American users, or a similar TTP223 capacitive touch button for European users.
These worked great and the switched output is debounced by itself.
(Hans updated the link since the forum did something wonky with it, and added a link for the same kind of buttons in Europe)