Re: {LVL1} Programming LEG strip where am I going wrong?

7 views
Skip to first unread message

Brian Wagner

unread,
Jan 11, 2018, 7:47:12 AM1/11/18
to LVL1 - Louisville's MakerSpace
Tyr changing this ...

void fadeInAndOut(uint8_t green, uint8_t yellow, uint8_t blue, uint8_t red, uint8_t wait) {

  for(uint8_t b=0; b <255; b++) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255, yellow*b/255, blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };

  for(uint8_t b=255; b > 0; b--) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255, yellow*b/255, blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };
};

to

void fadeInAndOut(uint8_t green, uint8_t blue, uint8_t red, uint8_t wait) {

  for(uint8_t b=0; b <255; b++) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255,  blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };

  for(uint8_t b=255; b > 0; b--) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255,  blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };
};



The first 3 parameters of fade in and out are the Green, Blue and Red colors that get sent to setpixel color.  There is no yellow.  You can set any color by setting the g,b,r of a tri color pixel.

Brian


On Thu, Jan 11, 2018 at 12:52 AM, Michael Hammons <gothicgeekp...@gmail.com> wrote:
All I did was add a 4th color.






// fade in and out

#include <Adafruit_NeoPixel.h>
#define LEDPIN 6 // connect the Data from the strip to this pin on the Arduino
#define NUMBER_PIEXELS 60 // the number of pixels in your LED strip
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMBER_PIEXELS, LEDPIN, NEO_GRB + NEO_KHZ800);

int waitTime = 10;

void setup() {
  strip.begin();
}

void loop() {
  fadeInAndOut(0, 255, 0, waitTime); // Green
  fadeInAndOut(255, 255, 0, waitTime); // Yellow
  fadeInAndOut(0, 0, 255, waitTime); // Blue
  fadeInAndOut(255, 0, 0, waitTime); // Red
}

void fadeInAndOut(uint8_t green, uint8_t yellow, uint8_t blue, uint8_t red, uint8_t wait) {

  for(uint8_t b=0; b <255; b++) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255, yellow*b/255, blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };

  for(uint8_t b=255; b > 0; b--) {
     for(uint8_t i=0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, green*b/255, yellow*b/255, blue*b/255, red*b/255);
     }
     strip.show();
     delay(wait);
  };
};
 

C:\Users\Sins\Documents\Arduino\sketch_dec12a\sketch_dec12a.ino:21:6: note: declared here

 void fadeInAndOut(uint8_t green, uint8_t yellow, uint8_t blue, uint8_t red, uint8_t wait) {

      ^

exit status 1
too few arguments to function 'void fadeInAndOut(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)'


--
You received this message because you are subscribed to the Google Groups "LVL1 - Louisville's Hackerspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lvl1+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Wagner

unread,
Jan 11, 2018, 7:52:24 AM1/11/18
to LVL1 - Louisville's MakerSpace
Reply all
Reply to author
Forward
0 new messages