EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: Youkai on May 07, 2019, 11:48:36 pm

Title: Adafruit NeoPixel nonsense (Why won't it work?)
Post by: Youkai on May 07, 2019, 11:48:36 pm
I'm having some trouble getting my NeoPixel's working. At this point I'm just trying to do a simple test to get the thing to cycle through R, G, B, W for a second each to confirm it's working.

This topic is related to my other thread: https://www.eevblog.com/forum/projects/borderlands-style-jewelry-box-research-thread/ (https://www.eevblog.com/forum/projects/borderlands-style-jewelry-box-research-thread/)

I have wired up the attached circuit which is a small section of the whole circuit I'l be designing. I am using an Arduino Uno. I plugged the power (Yellow) into the 5v pin, Ground (Black) into the GND pin, and data (Green) into pin 6. Then I used the below code to run the strip. I'm getting nothing. No light at all.

Originally I had it doing a "for" loop to set all of the pixels to the same color but I read in the uberguide that the arduino 5v pin might not be able to supply enough current for that so I brought it down to just the third pixel.

I also tried a NeoPixel strip with only wires (i.e. none of the other circuitry) and that didn't work either. I'm hoping that the issue is with my program and not that pixels are so fragile that I accidentally bricked two of them.

Code: [Select]
#include <Adafruit_NeoPixel.h>

#define neoPixelPin 6
#define neoPixelCount 8

Adafruit_NeoPixel lidPixel(neoPixelCount, neoPixelCount, NEO_RGBW + NEO_KHZ800);

void setup() {
  lidPixel.begin();
  lidPixel.show();
  Serial.begin(9600);
  Serial.println("Starting");
}

void loop() {
  lidPixel.setPixelColor(2, lidPixel.Color(255, 0, 0, 0));
  lidPixel.show();
  Serial.println("Red");
  delay(1000);

  lidPixel.setPixelColor(2, lidPixel.Color(0, 255, 0, 0));
  lidPixel.show();
  Serial.println("Green");
  delay(1000);

  lidPixel.setPixelColor(2, lidPixel.Color(0, 0, 255, 0));
  lidPixel.show();
  Serial.println("Blue");
  delay(1000);

  lidPixel.setPixelColor(2, lidPixel.Color(0, 0, 0, 255));
  lidPixel.show();
  Serial.println("White");
  delay(1000);
}
Title: Re: Adafruit NeoPixel nonsense (Why won't it work?)
Post by: MarkF on May 08, 2019, 12:11:12 am
I didn't look through all of your code.

But, I found one setup error:
Code: [Select]
Adafruit_NeoPixel lidPixel(neoPixelCount, neoPixelCount, NEO_RGBW + NEO_KHZ800);
should be
Code: [Select]
Adafruit_NeoPixel lidPixel(neoPixelCount, neoPixelPin, NEO_RGBW + NEO_KHZ800);
Title: Re: Adafruit NeoPixel nonsense (Why won't it work?)
Post by: Youkai on May 08, 2019, 12:17:24 am
WOW. I'm a dummy! Yeah that did it. You are a genius! Haha thanks.
Title: Re: Adafruit NeoPixel nonsense (Why won't it work?)
Post by: MarkF on May 08, 2019, 12:22:57 am
No genius.  Just 35+ years of writing code.
Title: Re: Adafruit NeoPixel nonsense (Why won't it work?)
Post by: Youkai on May 08, 2019, 02:10:58 am
I've got almost 20 years of writing code in me. Sometimes it takes a genius to catch the "obvious" variable error. In that case I named them similarly enough my brain just read it the "correct" way when I scanned the code.