(Neopixels) How to keep the pixels of the same colour despite increasing brightness? I've been doing a fade function for the NeoPixels. However, the moment I have maximum brightness for the pixels, I noticed there 2 colours even though in my function I have only specified one colour. 

Some strips are one colour and the others are another colour. I
specified the colour to be blue for the strips however many strips are blue and the strips nearer the end are green (but closer to a blue-green colour).

Is there any way to keep the colour even when the brightness changes? I've read somewhere online a different colour is seen with different brightness levels i.e. setPixelColor(brightness, r,g,b). 

I've also tried FastLED library and followed documentation. However, the lights are not doing what it has said in the codes, I've tried leds[i].fadeLightBy(200) and it has given me no result.

My code for the fade function (edited from http://moving-rainbow.readthedocs.io/en/latest/guide/fade-in-and-out/):



void fade(uint32_t color) {
  for (int i = 0; i &lt; 255; i++) {
    for (int q = 0; q &lt; strip.numPixels(); q++) {
      strip.setPixelColor(q, Wheel((color) &amp; 255));
    }
    strip.setBrightness(i);
    strip.show();
  }

  //decreasing brightness
  for (int l = 255; l &gt; 255; l--) {
    for (int p = 0; p &lt; strip.numPixels(); p++) {
      strip.setPixelColor(p, Wheel((color) &amp; 255));
    }
    strip.setBrightness(l);
    strip.show();
  }
}


The method "Wheel" is from the Arduino Neopixel strandtest example.

uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if (WheelPos &lt; 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if (WheelPos &lt; 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}


Any advice on how I should go about doing it?
I have some simple NeoPixel fading going on in this example sketch:

/*
 * 
 * NeoPixels demo - fades colours (in array) up and down
 * 
 */

#include &lt;SPI.h&gt;
#include &lt;NeoPixels_SPI.h&gt;

const unsigned int PIXELS = 8; // Number of pixels in the string

void setup()
  {
  ledsetup();
  } // end of setup

float patterns [] [3] = {
  { 1, 0, 0 },  // red
  { 0, 1, 0 },  // green
  { 0, 0, 1 },  // blue
  { 1, 1, 0 },  // yellow
  { 1, 0, 1 },  // magenta
  { 0, 1, 1 },  // cyan
  { 1, 1, 1 },  // white
  { 160.0 / 256, 82.0 / 256, 45.0 / 256 },  // sienna
  { 46.0 / 256, 139.0 / 256, 87.0 / 256 },  // sea green

};

// number of items in an array
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

void loop() 
  {

  for (byte i = 0; i &lt; ARRAY_SIZE (patterns); i++) 
    {
    // fade up
    for (byte m = 0; m &lt; 100; m++)
      {
      showColor (PIXELS, patterns [i] [0] * m, patterns [i] [1] * m, patterns [i] [2] * m);
      delay (10);
      } // end of for

    // fade down
    for (byte m = 100; m &gt; 0; m--)
      {
      showColor (PIXELS, patterns [i] [0] * m, patterns [i] [1] * m, patterns [i] [2] * m);
      delay (10);
      } // end of for
    } // end of for each array item

  } // end of loop


This is using the simple NeoPixel library that I wrote using the SPI hardware. The library with the exact code above is available here.

Basically the fading is done by multiplying the floating-point values for the R/G/B values by a constant from 0 to 100 (you could make it 0 to 255).

Since the colours themselves are expressed in the range 0 .. 1 then the result of the multiplication would be 0 to 255. To my naked eye the colours seem true at all brightnesses.

To use the library on your Uno just connect +5V, Gnd, and the data pin is MOSI (D11 on the Uno).