#include "Arduino.h"
#include "FastLED.h"
#define NUM_LEDS 60 // Total number of leds used in the strip
#define DATA_PIN 1 //Data output pin
#define VR_PIN 3 //Potentiometer / Preset Pin for Speed Adjusting
#define buttonPin 0 //Push Button Pin
int colorRed[] = { 0, 15, 30, 45}; //start of color
int colorWht[] = { 5, 20, 35, 50};
int colorBlu[] = {10, 25, 40, 55};
int pres=0;
int VR_SPEED;
int SPEED;
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
pinMode(0, INPUT_PULLUP);
FastLED.setBrightness(200);
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
for (int i = 0; i < 4; i++) { // repeat pattern four times
for (int j = 0; j < 5; j++) { // five pixels per color
leds[colorBlu[i] + j] = 0x0000FF;
leds[colorRed[i] + j] = 0xFF0000;
leds[colorWht[i] + j] = 0xFFFFFF;
}
}
}
void loop() {
VR_SPEED = analogRead(VR_PIN);
SPEED = map(VR_SPEED, 1000, 0, 25, 100); //Potentiometer Scroll Speed
// empty
FastLED.show();
//delay(35); //Scroll speed
delay (SPEED);
//move each color one spot over
CRGB x =leds[NUM_LEDS-1];
for (int i = NUM_LEDS-1; i >= 1; i--) {
CRGB temp = leds[i-1];
leds[i] = temp;
}
leds[0]=x;
//Reverse
//CRGB x =leds[0];
//for (int i = 0; i < NUM_LEDS-1; i++) {
//CRGB temp = leds[i+1];
//leds[i] = temp;
//}
//leds[NUM_LEDS-1]=x;
}