Neopixel 16 LED fading problems

Hi all,

Got myself a 16 LED NeoPixel. Basically I want it simply to fade between two colours, I was hoping I could get it to fade a random times but with the issues I have simply getting the fade right I think anything more than that is out of my league haha.

I'll post my code below, took this example from the RGBW strand test and the fade is fine but I want to remove the flash between colours and I can't seem to do it. If I remove the gamma part of the code it just doesn't fade at all. Also It fades from red to orange but it sort of like snaps back from orange to red, it doesn't fade, can somebody help me with this? Fairly new to coding arduino so apologies if it's an easy fix.

#include <Adafruit_NeoPixel.h>
#define LED_PIN     6
#define LED_COUNT  16
#define BRIGHTNESS 50
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 3 = Pixel type flags, add together as needed:

void setup() {
  //Startup Light Sequence
  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
  // Fill along the length of the strip in various colors...
  colorWipe(strip.Color(255,   0,   0)     , 50); // Red
  colorWipe(strip.Color(  255, 90,   0)     , 50); // Orange
  colorWipe(strip.Color(  255,   255, 0)     , 50); // Yellow
  colorWipe(strip.Color(  0,   0,   0, 255), 50); // True white (not RGB white)
}

void loop() {

pulseWhite(5);
}

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
    strip.setPixelColor(i, color);         //  Set pixel's color (in RAM)
    strip.show();                          //  Update strip to match
    delay(wait);                           //  Pause for a moment
  }
}

void pulseWhite(uint8_t wait) {
  for(int j=0; j<256; j++) { // Ramp up from 0 to 255
    // Fill entire strip with white at gamma-corrected brightness level 'j':
    strip.fill(strip.Color(255, 0, 0, strip.gamma8(j)));
    strip.show();
    delay(wait);
  }

  for(int j=255; j>=0; j--) { // Ramp down from 255 to 0
    strip.fill(strip.Color(255, 90, 0, strip.gamma8(j)));
    strip.show();
    delay(wait);
  }
}

Thanks
Rob

I'm confused. You say you want to fade the leds, but your colorWipe() routine just cycles through your led strip, one at a time setting each pixel to a given color. That is not "fading"

Personally, I'm a fan of the FastLED library which works just fine with NeoPixels. It has tons of examples. You might consider checking it out.

Mapping from one color to another..

You typically have 3 bytes : Red, Green, Blue.

color one : R1, G1, B1 you want to fade to color 2 : R2, G2, B2.

Look at the Map() function in the arduino reference.

Set up 3 mappers, a red one, green one and blue one.

In an arm waving, marketing way of describing things. You go about it like this..

.

Get the Red green & blue colors from your starting and ending colors.
R1,G1, B1 & R2,G2,B2

for (int i=1;i<=100;i++) {
  Red = map(i, 1, 100, R1, R2);
  Green = map(i, 1, 100, G1,G2);
  Blue = map(i, 1, 100, B1,B2);
  setPixalColor(PixNum,Red,Green,blue);
  show();
}

You'll have to set up the variables. int would probably work fine for all of them. Look at the neopixel stuff for reading and setting color by RGB values. That's all there is to it.

-jim lee