ok, so heres the cylon fast led example, with some slight modifications on my part to make it non rainbow anymore.
what do i have to change/add to make groupings of the LED's different colors? i want the moving led to change colors after it has passed so many, like the first 59 are green, second red, etc.
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 259
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 7
#define COLOR_ORDER GRB
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
FastLED.setBrightness(60);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CRGB(255,0,0);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB(0,0,0);
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CRGB(255,0,0);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB(255,0,0);
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
}
i dont know what im doing right, or wrong, this sketch makes the entire strip turn off, then the first led turns blue, then a green "cylon" starts at the end and goes forward, once it reaches the start the first led turns off, then it starts over, but on the second pass the second led turns off, then the third pass the third led, so on and so forth.
why is this so complicated
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 259
#define MAX_AMPS 500
#define BRIGHTNESS 60
#define VOLTS 5
#define DATA_PIN 7
#define COLOR_ORDER GRB
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS,MAX_AMPS);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t ;
Serial.print("x");
for(int i = 0; i < NUM_LEDS; i++) {
if (i < 58) {
leds[i] = CRGB(0, 255, 0);
}
if (i < 116) {leds[i] = CRGB(255, 0, 0);
}
if (i < 175) {leds[i] = CRGB(0, 0,255);
}
if (i < 234) {leds[i] = CRGB(128, 0, 128);
}
if (i > 234) {leds[i] = CRGB(85,85,85);
}
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
leds[i] = CRGB(0,0,0);
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
// Now go in the other direction.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(0, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
}
}
thank you!! that is what i was looking for, i only have one last question, when the led's fade to black how would i make them not fade all the way? like, only fade to half brightness?
i had originally wanted them to fade all the way to black, and you helped me acheive that, but now looking at it i think it would look better if it didnt fade all the way out.