Let me see if I can help ... so first of all you'll need to decide what library you're going to be using - FastLED of NeoPixel.
In your code you use both which will most likely cause conflicts and issues.
Of these 2 lines, remove one of them (I'd keep the FastLED library - better, more mature and faster, and some of your code seems to be using FastLED stuff):
#include "FastLED.h"
#include <Adafruit_NeoPixel.h>
Next problem is that every (standard) Arduino code has two major functions (see also my beginners course where you can find some of the basics).
One to initialize things:
void setup (
...
}
and one loop dat keeps repeating
void loop (
...
}
That last one seem to be missing so nothing will really happen with your code.
In that loop you'll probably want to call your "switchInput" function, so the Arduino keeps looking at the switches.
Probably something like this (assuming PIN0, PIN1 and PIN2 are switches):
void loop {
switchInput(PIN_SWITCH1, PIN_SWITCH2, PIN_SWITCH3);
}
Ask you can see, I renamed the defined pins to a more meaning full and less confusing name - good habit to learn over time as it makes your code easier to read and fix.
Next you have a function (RunningLights) defined in a function which is not a good thing to do.
Taking this function definition out of the other function, comes with an issues since it asks for red, green and blue values, which are nowhere found (replaced them with "??").
Since we're using FastLED, the "conversion" function (between FastLED and NeoPixel - eg. ShowStrip) are no longer needed and you can use the FastLED counter part.
Some basic cleanup makes it look like this but more needs to be done to make this more useful - hope it helps 😊
Note: untested, no warranty so you computer may explode 😉 -- and it will fail when you try to compile it because of the missing parameter values of "RunningLights". So it still needs work!
#include "FastLED.h"
# LEDs
#define NUM_LEDS 100
#define PIN_LEDS 13
#define CHIPSET WS2811
#define BRIGHTNESS 200
CRGB leds[NUM_LEDS];
# switches
#define PIN_SWITCH1 11
#define PIN_SWITCH2 10
#define PIN_SWITCH3 9
#define ON 1
#define OFF 0
void setup() {
FastLED.addLeds<CHIPSET, PIN_LEDS>(leds, NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
}
void loop {
switchInput(PIN_SWITCH1, PIN_SWITCH2, PIN_SWITCH3);
}
void switchInput(int inputOne, int inputTwo, int inputThree) {
if (digitalRead(inputOne) == ON && digitalRead(inputTwo) == OFF && digitalRead(inputThree) == OFF) {
for (int i = 0; i < NUM_LEDS; i++)
leds[i] = CRGB::Red;
FastLED.show();
}
if (digitalRead(inputOne) == OFF && digitalRead(inputTwo) == ON && digitalRead(inputThree) == OFF) {
for (int i = 0; i < NUM_LEDS; i++)
leds[i] = CRGB::Green;
FastLED.show();
}
if (digitalRead(inputOne) == OFF && digitalRead(inputTwo) == OFF && digitalRead(inputThree) == ON) {
RunningLights( ??, ??, ?? );
}
}
void RunningLights(byte red, byte green, byte blue, int WaveDelay) {
int Position=0;
for(int j=0; j<NUM_LEDS*2; j++)
{
Position++; // = 0; //Position + Rate;
for(int i=0; i<NUM_LEDS; i++) {
// sine wave, 3 offset waves make a rainbow!
//float level = sin(i+Position) * 127 + 128;
//setPixel(i,level,0,0);
//float level = sin(i+Position) * 127 + 128;
setPixel(i,((sin(i+Position) * 127 + 128)/255)*red,
((sin(i+Position) * 127 + 128)/255)*green,
((sin(i+Position) * 127 + 128)/255)*blue);
}
FastLED.show();
delay(WaveDelay);
}
void setPixel(int Pixel, byte red, byte green, byte blue) {
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
}
void setAll(byte red, byte green, byte blue) {
for(int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, red, green, blue);
}
FastLED.show();
}