Neopixel misbehaving for Spark Core

I’m having a rather interesting issue with my Spark Core. It’s almost as if there’s something fubar with the baudrate. I have no clue what is going on. Help! :open_mouth:

Here’s a video of the behavior:

If it doesn’t play let me just tell you it’s lighting up in different colors and seemingly different intensity all willy nilly.

Here’s the code that’s causing the behavior (simple example that should work, i’ve only added the line setting the brightness):

 * This is a minimal example, see extra-examples.cpp for a version
 * with more explantory documentation, example routines, how to
 * hook up your pixels and all of the pixel types that are supported.

#include "application.h"
#include "neopixel/neopixel.h"


#define PIXEL_PIN D2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

void setup()
  strip.setBrightness(8);; // Initialize all pixels to 'off'
void loop()

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);

@Coinhunter does this behavior persist when you try keeping it a solid color and not looping the rainbow? see code below on how to do that.

Add this function just above the line containing "void rainbow(unit8_t wait)

void whiteStrip(uint8_t wait)
    uint16_t i;
    for (int i = 0 ; i < strip.numPixels() ; i += 1 )
        strip.setPixelColor(i, strip.Color(255,255,255));

Then Update your Loop to look like this one below

void loop()
  whiteStrip(200000); //Setting this to loop every 200 seconds

Does the behavior change or stay the same when you add the code above and recompile?

Yes, I actually managed to figure out what was going on. It was a mis-aligned power-supply frequency. I wasn’t using the same power supply for both the core and the pixels. For some reason that interfered with the timing and caused the behavior.