Button Switch With 2 Modes For Adafruit RGB LED Strip with Arduino

Hello.

I would like to use a button pressed to change the mode between my Adafruit RGB LED Wire from flashing, to off, and back with the click of a button. I have put a button onto my Arduino and connected it to pin 7. Here is an example of the "flashing" code.

In the code, Black means off.
Thank you!

#include "FastLED.h" // library for LED's to work.
#define NUM_LEDS 60
#define DATA_PIN 6

int val; // the value of the potentiometer.
int potpin = 0; // potentiometer output.
int elPin = 13; // pin for EL Wir.

CRGB leds[NUM_LEDS]; // Defines the array of leds

void setup() {
  ;
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);// imports code from library and uses it to control 60 LED's controlled by pin 6.
  pinMode(elPin, OUTPUT); // sets output for pin 13 (EL Wire)

}

void loop() {
  {
    val = analogRead(potpin);         // reads the value of the potentiometer (value between 0 and 1023)
    val = map(val, 0, 1023, 500, 5); // maps the value

    for (int x = 0; x < NUM_LEDS ; x++) //defines number of LED's
    {
      leds[x] = CRGB::White; // changes LED color to white
    }
    FastLED.show();
    delay(val); //value of delay is the value of the potentiometer


    {

      for (int x = 0; x < NUM_LEDS ; x++) //defines number of LED's
      {
        leds[x] = CRGB::Black; // changed LED color to black AKA off
      }
      FastLED.show();//shows
      delay(val);//value of delay is the value of the potentiometer

    }
  }
  {
    {
      digitalWrite(elPin, HIGH); // EL Wire is synced with LED wire


    }
  }
}

I would like to use a button pressed to change the mode between my Adafruit RGB LED Wire from flashing, to off, and back with the click of a button.

The first thing to get your head round is detecting when a pin becomes HIGH (or LOW) rather than when it is HIGH (or LOW). Look at the StateChangeDetection example in the IDE.

Once you have that nailed you can use the value of a state variable to influence which code is executed. However, in order to have the program be responsive to the state change you will almost certainly have to refactor it to use millis() for timing instead of delay() because during a delay() nothing happens and that includes reading the state of an input. Several things at the same time would be a good place to read up on using millis() in that way.

The second thing you {need} {to} get your head {around} is when curly braces are needed, when {they} are {optional} and when they are just stupid.

Most of your fall into the last category.