Help with filling in the gaps

Hi Everyone

I’ve been working on this NeoPixel project and I’ve becoming completely confused by the whole thing. I’ve done most of it but there are little bits missing that I can’t get my head around - mainly with getting the buttons to work. I was wondering if someone could please help me fill in the gaps?

What I’ve been working on / what I want to achieve:
I want to press a tactile switch to iterate through the different colour modes (various colour combinations) with each press (one press per mode) and save the last array index value to a variable. That value will be used by the Trigger function when it’s executed.

Each colour mode is a function which assigns the four NeoPixels their various colours or animations.

The Trigger function will execute the selected colour mode after a delay when a different tactile switch is pressed and turn off after a set duration.

// -----------------------------------------------------------------------------------------
// NEOPIXEL SETUP
// -----------------------------------------------------------------------------------------

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN            12

// How many NeoPixels are attached to the Arduino?
#define NumPixels      4

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. 
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NumPixels, PIN, NEO_GRB + NEO_KHZ800);

// -----------------------------------------------------------------------------------------
// VARIABLES
// -----------------------------------------------------------------------------------------



// -----------------------------------------------------------------------------------------
// CONSTANTS
// -----------------------------------------------------------------------------------------

const int BtnTrigger = 2; // Interrupt attached to SW1.
const int BtnColourMode = 3; // Interrupt attached to SW2.

// -----------------------------------------------------------------------------------------
// SETUP FUNCTION
// Setup code will run once.
// -----------------------------------------------------------------------------------------

void setup(){

  pinMode(BtnTrigger, INPUT);
  pinMode(BtnColourMode, INPUT);
  pinMode(BuzzerPin, OUTPUT);
  
  attachInterrupt(digitalPinToInterrupt(BtnTrigger), Trigger, CHANGE);
  attachInterrupt(digitalPinToInterrupt(BtnColourMode), Colour_Mode_Select, CHANGE);

  pixels.begin(); // This initialises the NeoPixel library.
  
}

// -----------------------------------------------------------------------------------------
// DIFFERENT COLOUR MODE FUNCTIONS
// -----------------------------------------------------------------------------------------

void pink(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(200,55,90));
    pixels.show(); //
  }
}

void red(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,0,0));
    pixels.show(); //
  }
}

void orange(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,100,0)); // Orange
    pixels.show(); //
  }
}

void amber(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,180,0));  // Amber for all LEDs
    pixels.show(); //
  }
}


void yellow(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(200,200,0));  
    pixels.show(); //
  }
}

void lime(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(90,230,0));  // Lime for all LEDs
    pixels.show(); 
  }
}

void green(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,200,0));  // Green for all LEDs
    pixels.show(); 
  }
}

void cyan(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,170,200));  // Cyan for all LEDs
    pixels.show(); //
  }
}

void blue(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,0,200));  // Blue for all LEDs
    pixels.show(); //
  }
}

// -----------------------------------------------------------------------------------------
// COLOUR MODE FUNCTION ARRAY
// Takes all of the colour mode functions and stores them into an array so they can be 
// iterated through with the Loop Function.
// -----------------------------------------------------------------------------------------

void (*Colour_Mode_Functions[])() = 
{
  pink,
  red,
  orange,
  amber,
  yellow,
  lime,
  green,
  cyan,
  blue,
}

// -----------------------------------------------------------------------------------------
// COLOUR MODE SELECT FUNCTION
// Goes through and selects a colour mode with a button press from the array and saves the 
// index number and saves to a colour variable. This button is attached to an interrupt.
// -----------------------------------------------------------------------------------------

int buttonPress;

void Colour_Mode_Select() {
  
  int buttonPress = 3;   // 3 is an example
  Colour_Mode_Functions[buttonPress] ();
}



// -----------------------------------------------------------------------------------------
// TRIGGER FUNCTION
// When a button is pressed, wait for five seconds and then execute the function attached  
// to the colour variable for twenty seconds before turning off the NeoPixels. 
// This button is attached to an interrupt.
// -----------------------------------------------------------------------------------------

void trigger(){

  // Wait for five seconds
  delay(5000);
  
  // Turn on NeoPixels
  Colour_Mode_Functions[buttonPress] ();
  
  // Turn off NeoPixels after twenty seconds
  delay(20000);
  for(int j = 0; j < NumPixels; j++){
    pixels.setPixelColor(j, pixels.Color(0,0,0)); 
    pixels.show(); // This sends the updated pixel color to the hardware.
   }
}

// -----------------------------------------------------------------------------------------
// LOOP FUNCTION
// Loop code will run repeatedly.
// -----------------------------------------------------------------------------------------

void loop() {

  int BtnTriggerState = digitalRead(BtnTrigger);
  int BtnColourModeState = digitalRead(BtnColourMode);
  
  // Execute ColourMode Function
  if(digitalRead(BtnColourMode) == HIGH){
    delay(100); // debounce delay
    if (BtnTriggerState == HIGH) {
      timer = millis();
      for (int i=0; i < sizeof(Colour_Mode_Functions)-1; i++){
        Colour_Mode_Select();
      }  
    else if(timer >= 1000){
      //Millis    wait a second after the button has been pressed
      //when the button is pressed, t_i= 0. Turn off after t_f = 1000ms
       for(int i=0;i<NUMPIXELS;i++){
          pixels.setPixelColor(i, pixels.Color(0,0,0));
          pixels.show();
       }
      }
    }
  }
  // Execute Trigger Function
  if(digitalRead(BtnTrigger) == HIGH){
      delay(100); // debounce delay
      Trigger();
    }
  
}


  delay(50); // Debounce
  LastBtnTriggerState = BtnTriggerState;
  LastBtnColourModeState = BtnColourModeState;
}

Cody_Makes_Things: I want to press a tactile switch to iterate through the different colour modes (various colour combinations) with each press (one press per mode) and save the last array index value to a variable. That value will be used by the Trigger function when it's executed.

Each colour mode is a function which assigns the four NeoPixels their various colours or animations.

The Trigger function will execute the selected colour mode after a delay when a different tactile switch is pressed and turn off after a set duration.

Clarify please; you want to visually sequence through the array of colors with a button click, then once that color is displayed for a period of time (button stops being pressed), execute a function that does something with that color?

I see blocking code in your functions, you should not need that, even with NeoPixels. You should not have to use interrupts for switching if you get rid of the blocking.

Hi BulldogLowell, thank you for the reply!

Sorry for the poor explanation. It might be better explained if I run through the process what I’ll be doing with it once it’s done. This is for my light painting / orb tool.

I’m going to stand behind the camera and choose the colour mode (colour combination). When I press it’s going to show one combination and when I release the button it goes away / turns off; when I press the button again it shows the next combination and so on.

I’m going to turn on the camera and walk into the scene where I want to spin the orb, I’ll press the trigger button which’ll wait five seconds (this gives me time to start spinning) and then the NeoPixels turn on for twenty seconds (this is when I spin the orb) before turning off after twenty seconds.

NeoPixels are function blocks because I’ll end up using more function blocks like this which are dependant on other functions and stuff like that. To my understanding I can’t to things like that if the Neopixels are daisy chained. I’ve already spin the board.

void theaterChase_blue_cyan_green(){
  while(1){
    theaterChase(pixels.Color(0,170,200), 50); // Theatre Chase Cyan
    theaterChase(pixels.Color(1, 127, 0), 50); //  Theatre ChaseGreen
    pixels.setPixelColor(2, pixels.Color(0,0,200)); // Static Blue
    pixels.setPixelColor(3, pixels.Color(0,0,200));  // Static Blue
  }
}

// Which is dependant on the below function.

void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<3; j++) {  //do 3 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {
        pixels.setPixelColor(i+q, c);    //turn every third pixel on
      }
      pixels.show();

      delay(wait);

      for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {
        pixels.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}


An example of one of my orb photos


3D Printed RGB Orb Tool - Prototype

There is a big and important difference between function blocks and blocking functions. No one mentioned function blocks. Blocking functions can make what you want to do quite difficult or even impossible.

To my understanding I can't to things like that if the Neopixels are daisy chained. I've already spin the board.

Can you run through that sentence again please, I didn't understand it.

I can't see any such limitations inherent in the Neopixels operation that would prevent you from doing what ever you want. I still can't see what you want.

Very nice photos by the way.

Cody_Makes_Things:
I’m going to stand behind the camera and choose the colour mode (colour combination). When I press it’s going to show one combination and when I release the button it goes away / turns off; when I press the button again it shows the next combination and so on.

I’m going to turn on the camera and walk into the scene where I want to spin the orb, I’ll press the trigger button which’ll wait five seconds (this gives me time to start spinning) and then the NeoPixels turn on for twenty seconds (this is when I spin the orb) before turning off after twenty seconds.

OK, so I get it, you want to use one button to (behind the camera) to select which colour you will use. You will then walk into the frame of the photo, and start the program that displays the functions using that selected colour as its base colour. You need 5 seconds to get that “psychedelic mace” spinning, at which time the LEDS illuminate and progress through the sequences you defined in that function and the exposure sees all of those light traces.

@Grumpy_Mike is right, the photos are cool…

I got excited about making one of these for my wife who is also a photographer.

you can try this for now, though it is not done:

#include <Adafruit_NeoPixel.h>

#define PIN 12
#define NumPixels 4

enum OperatingState{
  STANDBY,  // waiting for any button press
  COLOR_SELECT,  // got a colorSelector button press, will increment with successive presses of colorSelector
  DISPLAY_COLOR_SEQUENCE,
  STATES_MAX
}state = STANDBY;

byte colors[][3] =
{
  {200,  55,  90}, //pink
  {255,   0,   0}, //red
  {255, 100,   0}, //orange
  {255, 180,   0}, //amber
  {200, 200,   0}, //yellow
  { 90, 230,   0}, //lime
  {  0, 200,   0}, //green
  {  0, 170, 200}, //cyan
  {  0,   0, 200}, //blue
};

byte colorState = 0;

byte off[3] = {0,0,0};

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NumPixels, PIN, NEO_GRB + NEO_KHZ800);

const byte colorSelector = 2;
const byte startTrigger = 3;
const byte buzzerPin = 9;

unsigned long lastEventMillis = 0;

void setup(void)
{
  Serial.begin(9600);
  pinMode(colorSelector, INPUT_PULLUP);
  pinMode(startTrigger, INPUT_PULLUP);
  pinMode(buzzerPin, OUTPUT);
  pixels.begin(); // This initialises the NeoPixel library.
}

void loop(void)
{
  static OperatingState lastState = STATES_MAX;
  if(state != lastState)
  {
    switch(state)
    {
      case STANDBY:
        Serial.println("Standby Mode");
        break;
      case COLOR_SELECT:
        Serial.println("Color Select Mode");
        Serial.print("Current Color: ");
        Serial.println(colorState);
        break;
      case DISPLAY_COLOR_SEQUENCE:
        Serial.println("Display Sequence Mode");
        break;
    }
    lastState = state;
  }
  switch(state)
  {
    case STANDBY:
      if(colorSelectorPressed())
      {
        state = COLOR_SELECT;
        displayCurrentColor(colors[colorState]);
        lastEventMillis = millis();
      }
      if(startTriggerPressed())
      {
        state = DISPLAY_COLOR_SEQUENCE;
        lastEventMillis = millis();
      }
      break;
    case COLOR_SELECT:
      if(colorSelectorPressed()) // increment the color and reset the timer
      {
        colorState++;
        colorState %= sizeof(colors)/sizeof(colors[0]);
        Serial.print("Current Color: ");
        Serial.println(colorState);
        lastEventMillis = millis();
      }
      if(millis() - lastEventMillis > 3000)
      {
        state = STANDBY;
        displayCurrentColor(off);
      }
      break;
    case DISPLAY_COLOR_SEQUENCE:
      if(millis() - lastEventMillis < 5000)
      {
        // do nothing
      }
      else if(millis() - lastEventMillis < 25000)
      {
        displayLedSequence(colors[colorState]);
      }
      else 
      {
        displayCurrentColor(off);
        state = STANDBY;
      }
      break;
  }
}

void displayLedSequence(byte* color)
{
  //TBD
}

bool startTriggerPressed()
{
  static unsigned long lastMillis = 0;
  static byte lastState = HIGH;
  const byte newState = digitalRead(startTrigger);
  if(newState != lastState)
  {
    if(millis() - lastMillis > 250)
    {
      if(newState == LOW) // pressed
      {
        lastMillis = millis();
        return true;
      }
    }
  }
  return false;
}

bool colorSelectorPressed()
{
  static unsigned long lastMillis = 0;
  static byte lastState = HIGH;
  const byte newState = digitalRead(colorSelector);
  if(newState != lastState)
  {
    if(millis() - lastMillis > 250)
    {
      if(newState == LOW) // pressed
      {
        lastMillis = millis();
        return true;
      }
    }
  }
  return false;
}

void displayCurrentColor(byte* color)
{
  for(byte i = 0; i < NumPixels; i++)
  {
    pixels.setPixelColor(i, pixels.Color(color[0], color[1], color[2]));
  }
  pixels.show();
}

Thank you, I’m glad you like the photo BulldogLowell and Grumpy_Mike.

I hope you and your wife enjoy spinning a few orbs, it’s a lot of fun.

That’s spot on, that’s want to do. :slight_smile:

Thank you so much for the code!

I’m sorry, I should’ve added the rest of the colour functions. There are some more complex ones that I’m trying to use and that’s why I put them into functions. I’m stuck on trying to go through with successive presses of a button - how could I do that? Sorry, my explanation skills are fairly terrible.

void pink(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(200,55,90));
    pixels.show(); //
  }
}

void pink_amber(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(200,55,90)); // Pink
   pixels.setPixelColor(1, pixels.Color(200,55,90));
   //pixels.setPixelColor(2, pixels.Color(200,55,90)); 
   //pixels.setPixelColor(3, pixels.Color(200,55,90));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(255,180,0)); // Amber
   pixels.setPixelColor(3, pixels.Color(255,180,0));
   pixels.show();  
}

void pink_blue(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,0,200)); // Blue
   pixels.setPixelColor(1, pixels.Color(0,0,200)); 
   //pixels.setPixelColor(2, pixels.Color(0,0,200)); 
   //pixels.setPixelColor(3, pixels.Color(0,0,200)); 
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(200,55,90)); // Pink
   pixels.setPixelColor(3, pixels.Color(200,55,90)); 
   pixels.show();
}

void red(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,0,0));
    pixels.show(); //
  }
}

void orange(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,100,0)); // Orange
    pixels.show(); //
  }
}

void orange_white(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(255,100,0));   // Orange
   pixels.setPixelColor(1, pixels.Color(255,100,0));
   //pixels.setPixelColor(2, pixels.Color(255,100,0));       
   //pixels.setPixelColor(3, pixels.Color(255,100,0));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(200,200,0));  // White
   pixels.setPixelColor(3, pixels.Color(200,200,0));
   pixels.show();  
}

void amber(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(255,180,0));  // Amber for all LEDs
    pixels.show(); //
  }
}

void amber_white(){ // 
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(255,180,0)); // Amber
   pixels.setPixelColor(1, pixels.Color(255,180,0));
   //pixels.setPixelColor(2, pixels.Color(255,180,0)); 
   //pixels.setPixelColor(3, pixels.Color(255,180,0));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(100,100,100)); // White
   pixels.setPixelColor(3, pixels.Color(100,100,100));
   pixels.show();
}

void amber_flashBlue(){ // Case 1
  pixels.setPixelColor(0, pixels.Color(255,180,0)); // Amber
  pixels.setPixelColor(1, pixels.Color(255,180,0)); 
  //pixels.setPixelColor(2, pixels.Color(255,180,0)); // Amber
  //pixels.setPixelColor(3, pixels.Color(255,180,0)); 
  pixels.show();
  
  while(1){
      pixels.setPixelColor(1, pixels.Color(0,0,127)); // Blue
      pixels.setPixelColor(3, pixels.Color(0,0,127)); 
      pixels.show();
      delay(100);
      pixels.setPixelColor(1, pixels.Color(0,0,0)); // Off
      pixels.setPixelColor(3, pixels.Color(0,0,0));  
      pixels.show();
      delay(500);
  }
}

void amber_blue(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(255,180,0)); // Amber
   pixels.setPixelColor(1, pixels.Color(255,180,0));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(0,0,200)); // Blue
   pixels.setPixelColor(3, pixels.Color(0,0,200));
   pixels.show();  
}

void yellow(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(200,200,0));  
    pixels.show(); //
  }
}

void yellow_blue_pink_white(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(200,200,0)); // Yellow
   pixels.setPixelColor(1, pixels.Color(0,0,200)); // Blue
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(200,55,90)); // Pink
   pixels.setPixelColor(3, pixels.Color(100,100,100)); // White
   pixels.show();  
}

void lime(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(90,230,0));  // Lime for all LEDs
    pixels.show(); 
  }
}

void green(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,200,0));  // Green for all LEDs
    pixels.show(); 
  }
}

void green_flashBlue(){ // Case 4
  pixels.setPixelColor(0, pixels.Color(0,200,0)); // Green
  pixels.setPixelColor(2, pixels.Color(0,200,0)); 
  pixels.show();
  
  while(1){
      pixels.setPixelColor(1, pixels.Color(0,0,127)); // Blue
      pixels.setPixelColor(3, pixels.Color(0,0,127)); 
      pixels.show();
      delay(100);
      pixels.setPixelColor(1, pixels.Color(0,0,0)); // Off
      pixels.setPixelColor(3, pixels.Color(0,0,0));  
      pixels.show();
      delay(500);
  }
}

void green_blue(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,200,0)); // Green
   pixels.setPixelColor(1, pixels.Color(0,200,0));
   //pixels.setPixelColor(2, pixels.Color(0,200,0)); 
   //pixels.setPixelColor(3, pixels.Color(0,200,0));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(0,0,127)); // White
   pixels.setPixelColor(3, pixels.Color(0,0,127));
   pixels.show(); 
}

void cyan(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,170,200));  // Cyan for all LEDs
    pixels.show(); //
  }
}

void cyan_red(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,180,210)); // Cyan
   pixels.setPixelColor(1, pixels.Color(0,180,210));     
   //pixels.setPixelColor(2, pixels.Color(0,180,210));     
   //pixels.setPixelColor(3, pixels.Color(0,180,210));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(255,0,0)); // Red
   pixels.setPixelColor(3, pixels.Color(255,0,0));
   pixels.show(); 
}

void blue(){
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,0,200));  // Blue for all LEDs
    pixels.show(); //
  }
}

void blue_green_yellow_red_white(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,0,200)); // Blue
   pixels.setPixelColor(1, pixels.Color(0,200,0)); // Green
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(200,200,0)); // Yellow
   pixels.setPixelColor(3, pixels.Color(200,0,0)); // Red
   pixels.show();  
}

void blue_green(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,0,200)); // Blue
   pixels.setPixelColor(1, pixels.Color(0,0,200));
   //pixels.setPixelColor(2, pixels.Color(0,0,200)); 
   //pixels.setPixelColor(3, pixels.Color(0,0,200));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(0,200,0)); // Green
   pixels.setPixelColor(3, pixels.Color(0,200,0));
   pixels.show();  
}

void blue_white(){
// Outside LEDs
   pixels.setPixelColor(0, pixels.Color(0,0,200)); // Blue
   pixels.setPixelColor(1, pixels.Color(0,0,200));
   //pixels.setPixelColor(2, pixels.Color(0,0,200)); 
   //pixels.setPixelColor(3, pixels.Color(0,0,200));
// Inside LEDs
   pixels.setPixelColor(2, pixels.Color(200,200,200)); // White
   pixels.setPixelColor(3, pixels.Color(200,200,200));
   pixels.show();  
}

void theaterChase_blue_cyan_green(){
  while(1){
    theaterChase(pixels.Color(0,170,200), 50); // Cyan
    theaterChase(pixels.Color(0, 127, 0), 50); // Green
    theaterChase(pixels.Color(0, 0, 127), 50); // Blue
  }
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<pixels.numPixels(); i++) {
      pixels.setPixelColor(i, Wheel((i+j) & 255));
    }
    pixels.show();
    delay(wait);
  }
}

void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<3; j++) {  //do 3 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {
        pixels.setPixelColor(i+q, c);    //turn every third pixel on
      }
      pixels.show();

      delay(wait);

      for (uint16_t i=0; i < pixels.numPixels(); i=i+3) {
        pixels.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return pixels.Color(255 - WheelPos * 3, 0, WheelPos * 3); 
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return pixels.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return pixels.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

So, would each color you select (did that work on your orb, pushing the buttons to sequence through your colors?) then run a separate function?

i.e.

I select using the color selector until I see say Pink color. Then, when I select startTrigger, it runs that unique Pink function.

yes?