Skip to main content
Tweeted twitter.com/StackArduino/status/839753954414190592
spelling corrections
Source Link
jfpoilpret
  • 9.1k
  • 7
  • 37
  • 54

I'm attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 LEDs at once.

I get no errors.

I don't understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. Seems like I'm grabbing one pixel, fading it to red, then another...

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
 
} 

void loop(){
 
  
  for(int x = 0; x < NUM_LEDS; x++){
    delay(10);
    leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){
 
    for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant ican't I just do it like this below: leds[NUM_LEDS]?

      leds[x] = CRGB(r,g,b);
      FastLED.show();
      delay(100);
  }
  }
  }
}

I'm attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 LEDs at once.

I get no errors.

I don't understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. Seems like I'm grabbing one pixel, fading it to red, then another...

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
 
}
void loop(){
 
  
  for(int x = 0; x < NUM_LEDS; x++){
  delay(10);
  leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){
 
  for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant i just do it like this below: leds[NUM_LEDS]?

leds[x] = CRGB(r,g,b);
FastLED.show();
delay(100);
  }
  }
  }

I'm attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 LEDs at once.

I get no errors.

I don't understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. Seems like I'm grabbing one pixel, fading it to red, then another...

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
} 

void loop(){
  for(int x = 0; x < NUM_LEDS; x++){
    delay(10);
    leds[x] = CRGB(r,g,b);
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  for(int x = 0; x < NUM_LEDS; x++){
    for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why can't I just do it like this below: leds[NUM_LEDS]?

      leds[x] = CRGB(r,g,b);
      FastLED.show();
      delay(100);
    }
  }
}

fading Fading from color to color using for-loop FastLEDs

ImI'm attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 ledsLEDs at once.

I get no errors.

I dontdon't understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. seemsSeems like imI'm grabbing one pixel,, fading it to red, then another....

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);

}
void loop(){

  
  for(int x = 0; x < NUM_LEDS; x++){
  delay(10);
  leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){

  for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant i just do it like this below: leds[NUM_LEDS]?

leds[x] = CRGB(r,g,b);
FastLED.show();
delay(100);
  }
  }
  }

fading from color to color using for-loop FastLEDs

Im attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 leds at once.

I get no errors.

I dont understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. seems like im grabbing one pixel,, fading it to red, then another....

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);

}
void loop(){

  
  for(int x = 0; x < NUM_LEDS; x++){
  delay(10);
  leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){

  for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant i just do it like this below: leds[NUM_LEDS]?

leds[x] = CRGB(r,g,b);
FastLED.show();
delay(100);
  }
  }
  }

Fading from color to color using for-loop FastLEDs

I'm attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 LEDs at once.

I get no errors.

I don't understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. Seems like I'm grabbing one pixel, fading it to red, then another...

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);

}
void loop(){

  
  for(int x = 0; x < NUM_LEDS; x++){
  delay(10);
  leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){

  for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant i just do it like this below: leds[NUM_LEDS]?

leds[x] = CRGB(r,g,b);
FastLED.show();
delay(100);
  }
  }
  }
Source Link
user28025
  • 53
  • 1
  • 2
  • 4

fading from color to color using for-loop FastLEDs

Im attempting to fade a strip of ws2812 7 pixels in length. Below I am using a for loop to increment the color red. I can fade it to red (from blue) but it will do it one pixel at a time or it just stays blue, depending where I move my r for-loop to. I need it to fade from color to color all 7 leds at once.

I get no errors.

I dont understand the process of getting NUM_LEDS leds all into x then proceeding with my color changing. seems like im grabbing one pixel,, fading it to red, then another....

fastLeds 3.03 library, arduino 1.0.6

#include <FastLED.h>
#define DATA_PIN 6
#define NUM_LEDS 7

#define BRIGHTNESS 45
#define COLOR_ORDER GRB
#define g 50
#define b 100
int r;
CRGB leds[NUM_LEDS];

void setup(){
  FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);

}
void loop(){

  
  for(int x = 0; x < NUM_LEDS; x++){
  delay(10);
  leds[x] = CRGB(r,g,b);
  
  }
  FastLED.show();
  delay(10); 

  //-------------------------
  
  

  
  for(int x = 0; x < NUM_LEDS; x++){

  for(int r = 0; r < 254; r++) {

if NUM_LEDS is holding the number 7 why cant i just do it like this below: leds[NUM_LEDS]?

leds[x] = CRGB(r,g,b);
FastLED.show();
delay(100);
  }
  }
  }