Help with switch case

Hello, I am trying to make code so that when a button is pressed once it turns on the LED and when pressed again it turns off. Double clicking the button should then change the effect that occurs when the light is turned on. Where in the code it says ////NOT SURE WHAT TO DO HERE/// if i put:

strip.setPixelColor(0, 255, 0, 0);
      strip.show();

It works with it tuning red and then off on subsequent presses. But to make it work how intended I am not sure how to do it.

#include "OneButton.h"                              //we need the OneButton library
#include <Adafruit_NeoPixel.h>

#define BUTTON_PIN   2
#define PIXEL_PIN 0
#define PIXEL_COUNT 1

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

OneButton button(2, true);

int i;
int x;

void setup() {

  button.attachDoubleClick(doubleclick);            // link the function to be called on a doubleclick event.
  button.attachClick(singleclick);                  // link the function to be called on a singleclick event.
  button.attachLongPressStop(longclick);            // link the function to be called on a longpress event.

  strip.begin();
  strip.show();
}

void loop() {
  button.tick();                                    // check the status of the button

  delay(10);                                        // a short wait between checking the button
} // loop

void doubleclick() {                                // what happens when button is double-clicked
  i = i + 1;
  if ( i > 4 ) {
    i = 0;
  }
}

void singleclick() {                                // what happens when the button is clicked
  x = x +1;
  if (x > 1){
    x = 0;
  }
  
  switch (x) {
    case 0: strip.setPixelColor(0, 0, 0, 0);
      strip.show();                                 // Black/off
      break;
      case 1: //// Not sure what to do here /////
      break;
  }

}

void longclick() {                                  // what happens when buton is long-pressed
    // Red

}

void lightMode() {
  switch (i) {
    case 0: rainbowCycle(20);
      break;
    case 1: strip.setPixelColor(0, 255, 0, 0);
      strip.show();   // Red
      break;
    case 2: strip.setPixelColor(0, 0, 255, 0);
      strip.show();     // Green
      break;
    case 3:  strip.setPixelColor(0, 0, 0, 255);
      strip.show();     // Blue
      break;

  }
}

//////////RAINBOW
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
    for (i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if (WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  } else {
    WheelPos -= 170;
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  }
}
///////////////////

Hopefully this makes sense, and thank you for any help anyone can give in advance.

Hopefully this makes sense

Nope.

I am trying to make code so that when a button is pressed once it turns on the LED and when pressed again it turns off.

Got that. The state change detection example is a perfect starting point.

Double clicking the button should then

What does "double clicking" mean to you? It doesn't mean a thing to the Arduino. To the Arduino, the pin that the switch is connected to is either HIGH or LOW. "double clicking" MIGHT mean that the pin changes from the state that means that the switch is not pressed to the state that means that the switch is pressed and back to the state that means that the switch is not pressed two times in less than x number of milliseconds. Whatever it means, you must have a very clear definition in mind before you can begin to implement that definition.

      case 1: //// Not sure what to do here /////

Well, only you know what you want to have happen when the switch is single clicked the second time.

void doubleclick() {                                // what happens when button is double-clicked
  i = i + 1;
  if ( i > 4 ) {
    i = 0;
  }
}

Nothing happens when the switch is double clicked (for whatever that means to the library) except that a stupidly named variable is incremented and constrained. Doesn't seem useful, because loop() doesn't care what value i has.

void longclick() {                                  // what happens when buton is long-pressed
    // Red

}

Useful. Not.

void lightMode() {
  switch (i) {

Pointless, since this function is never called.

I'm just guessing because I've never used the OneButton library so neither the code nor the description are 100% clear. But since doubleclick() changes the value of i (not exactly a helpful name) and lightMode() seems to use i to set something to do with different lighting effects what happens if you just call lightMode() in the "Not sure what to do here" case?

Steve