Author Topic: Adafruit NeoPixel nonsense (Why won't it work?)  (Read 936 times)

0 Members and 1 Guest are viewing this topic.

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Adafruit NeoPixel nonsense (Why won't it work?)
« 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/

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);
}
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2523
  • Country: us
Re: Adafruit NeoPixel nonsense (Why won't it work?)
« Reply #1 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);
« Last Edit: May 08, 2019, 12:14:55 am by MarkF »
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: Adafruit NeoPixel nonsense (Why won't it work?)
« Reply #2 on: May 08, 2019, 12:17:24 am »
WOW. I'm a dummy! Yeah that did it. You are a genius! Haha thanks.
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2523
  • Country: us
Re: Adafruit NeoPixel nonsense (Why won't it work?)
« Reply #3 on: May 08, 2019, 12:22:57 am »
No genius.  Just 35+ years of writing code.
 

Offline YoukaiTopic starter

  • Regular Contributor
  • *
  • Posts: 227
  • Country: us
Re: Adafruit NeoPixel nonsense (Why won't it work?)
« Reply #4 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf