Buttons to control LED strip WS2811/WS2812/Neopixel

Hi,

I'm an arduino newbie, diving right into the RGB led strip stuff (as that is why would like to use the arduino for)
I've looked via google and browsed some of the forums, but I don't seem to be able to "connect the dots" (I learn by example)

I've a piece of code (see below), giving some led effects (fastLED lib) and an on/off button (well... "on" button...)
I was advised to use the Switch library for the buttons, (debounce function).

(I'm using the buttons from the starterkit)

What I would like to do with this project :

  • 1 button : on/off (press = on, press again = off)
  • 2 buttons to cycle through the effects (like a "next" & "prev" button)
    (and maybe later:
  • 2 buttons to increase or decrease the max brightness
    )

I believe you can only have 1 interrupt for buttons? Otherwise I need to use timers?

What I think what needs to happen (logically) :

  • every X millsec the onoff buttons needs to be polled, when pressed the onoff value needs to be reversed, and the return to the (beginning) of the loop, if onoff = true -> leds on and start the effect, if onoff = false, all leds off
  • every X millsec the "prev" and "next" button need to be checked, when pressed, a counter needs to be updated (+1 or -1), returned to the beginning of the loop and start the next/prev effect (depending on the counter value)
    I would do that with a case statement

So, I appreciate very much advice, examples... to get me further on the right track

thanks

// Project : f1_ledcontroller
#include "FastLED.h"
#include "Arduino.h"
#include "Switch.h"
#include <Streaming.h>
const byte ButPin_OnOff = 13; 

// Number of leds in the block
#define NUM_LEDS 32
// datapin for LED data
#define DATA_PIN 6
// Define the array of leds
CRGB leds[NUM_LEDS];
#define MAX_BRIGHTNESS 255

Switch But_OnOff = Switch(ButPin_OnOff); 
boolean onoff = false;

void setup() { 
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  Serial.begin(9600);
}

void loop() { 
  But_OnOff.poll();  
  //if(But_OnOff.pushed()) Serial.println("pushed ") ;  
  //if(But_OnOff.released()) Serial.println("released ");
  //if(But_OnOff.switched()) Serial.println("switched ");

  if (But_OnOff.pushed())
  {
    onoff = !onoff;
    Serial.println("pushed") ;   
    Serial.println(onoff);

  }

  if (!onoff)
  {
    FastLED.clear();  
    FastLED.show(); 
  }

  if (onoff)
  {
    rainbow(20);
    cylon(CRGB::Red,25, 5);
    color_chase(CRGB::Green, 15);
    color_chase(CRGB::Red, 15);
    color_chase(CRGB::Blue, 15);

  }
}

*********** functions go here **************