I have a number of Flora Neopixels (v2). Everyone of them blinks green with the sketch listed below. If instead I set color.green=255 and color.red=0;, it blinks red. Blue works as expected.
Is there a problem with the pixels? the libraries? am I using the wrong library?
#include "Adafruit_FloraPixel.h"
Adafruit_FloraPixel strip = Adafruit_FloraPixel(1);
RGBPixel color;
void setup() {
strip.begin();
strip.show();
}
void loop() {
color.red=255;
color.green=0;
color.blue=0;
strip.setPixelColor(0, color);
strip.show();
delay(500);
color.red=0;
color.green=0;
color.blue=0;
strip.setPixelColor(0, color);
strip.show();
delay(500);
}
FloraPixel Problem
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: FloraPixel Problem
Earlier pixels were wired with red & green swapped...this is fixed in the current pixels, but the library was written for just the "classic" case.
I'd suggest downloading the NeoPixel library from github and using that instead of the FloraPixel library. It has some bells & whistles such as handling the different pixel types.
https://github.com/adafruit/Adafruit_NeoPixel
I'd suggest downloading the NeoPixel library from github and using that instead of the FloraPixel library. It has some bells & whistles such as handling the different pixel types.
https://github.com/adafruit/Adafruit_NeoPixel
- bruzer
- Posts: 2
- Joined: Mon Mar 25, 2013 1:16 pm
Re: FloraPixel Problem
I also noticed this Red is Green color problem with the NeoPixels v2 and the Adafruit_FloraPixel library. I tried several different sketches to prove to myself the colors were wrong. I thought I wired my pixels incorrectly or was going crazy! Glad I did a search here first.
I download the NeoPixel code on 04/10/2013 that you gave in the link but I can not get the strandtest example to compile.
Here is the error:
I am using the Adafruit Flora and four Flora NeoPixel v2 pixels wired in series. I realize the strandtest sets up for the LED strip, so even when I change the Adafruit_NeoPixel constructor to: Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, 6, NEO_RGB + NEO_KHZ400); I still can not compile it (and I get the same error).
What did I do wrong?
I download the NeoPixel code on 04/10/2013 that you gave in the link but I can not get the strandtest example to compile.
Here is the error:
Code: Select all
strandtest:10: error: 'Adafruit_NeoPixel' does not name a type
strandtest.pde: In function 'void setup()':
strandtest:13: error: 'strip' was not declared in this scope
strandtest.pde: In function 'void loop()':
strandtest:19: error: 'strip' was not declared in this scope
strandtest.pde: In function 'void colorWipe(uint32_t, uint8_t)':
strandtest:28: error: 'strip' was not declared in this scope
strandtest.pde: In function 'void rainbow(uint8_t)':
strandtest:39: error: 'strip' was not declared in this scope
strandtest:42: error: 'strip' was not declared in this scope
strandtest.pde: In function 'void rainbowCycle(uint8_t)':
strandtest:52: error: 'strip' was not declared in this scope
strandtest:55: error: 'strip' was not declared in this scope
strandtest.pde: In function 'uint32_t Wheel(byte)':
strandtest:64: error: 'strip' was not declared in this scope
strandtest:67: error: 'strip' was not declared in this scope
strandtest:70: error: 'strip' was not declared in this scope
What did I do wrong?
- pburgess
- Posts: 4161
- Joined: Sun Oct 26, 2008 2:29 am
Re: FloraPixel Problem
Looks like the library might not be properly installed. Confirm that:
- The ZIP file was uncompressed after downloading (Windows lets you navigate into ZIP files as if they were folders, which can be confusing sometimes).
- The resulting folder has been renamed 'Adafruit_NeoPixel'
- This folder has been placed inside your personal Sketchbook/Libraries folder, and
- The Arduino IDE is restarted after installing the library
(Are you using 'Open...' to load the strandtest sketch, or are you able to access it directly from the File->Sketchbook->Libraries menu? Is an Adafruit_NeoPixel rollover menu present there? That's one way to tell if the library is correctly installed.)
- The ZIP file was uncompressed after downloading (Windows lets you navigate into ZIP files as if they were folders, which can be confusing sometimes).
- The resulting folder has been renamed 'Adafruit_NeoPixel'
- This folder has been placed inside your personal Sketchbook/Libraries folder, and
- The Arduino IDE is restarted after installing the library
(Are you using 'Open...' to load the strandtest sketch, or are you able to access it directly from the File->Sketchbook->Libraries menu? Is an Adafruit_NeoPixel rollover menu present there? That's one way to tell if the library is correctly installed.)
- bruzer
- Posts: 2
- Joined: Mon Mar 25, 2013 1:16 pm
Re: FloraPixel Problem
The files were downloaded individually and the directories were created the properly. I did not restart the Arduino IDE. After a restart the strandtest seems to be working correctly. Thank you for the troubleshooting steps!
You wrote that the older pixels have the red and green pixels swapped. I have the Flora NeoPixels v2 (that arrived in April 2013) but it seems I need to specify NEO_GRB for the "Color" to be created correctly.
Does this mean the pixels I have have red and green "backwards"? I would have expected to use the NEO_RGB with the version 2 NeoPixels, but when constant NEO_RGB is used strip.Color(255, 0, 0) is green and strip.Color(0, 255, 0); is red.
Thanks for the troubleshooting steps I learned how to properly load the library.
You wrote that the older pixels have the red and green pixels swapped. I have the Flora NeoPixels v2 (that arrived in April 2013) but it seems I need to specify NEO_GRB for the "Color" to be created correctly.
Code: Select all
Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, 6, NEO_GRB + NEO_KHZ400);
Thanks for the troubleshooting steps I learned how to properly load the library.
- joshlucy
- Posts: 4
- Joined: Tue May 29, 2012 2:11 pm
Re: FloraPixel Problem
Hello, this is a bit of an old thread, but I'm having a problem in the same vein. I'm attempting to drive some NeoPixel V1 pixels from an ATTINY85, and I'm getting some errors compiling the code when I switch to NEO_KHZ400. Do you have any advice? I'm using the most recent version of the NeoPixel library, and I was using the goggles example.
Code: Select all
In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Stream.h:26:0,
from /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:193,
from /home/xmanj/arduino/sketchbook/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from sketch_sep03b.ino:1:
/usr/share/arduino/hardware/arduino/cores/arduino/Print.h:32:0: warning: "BIN" redefined [enabled by default]
#define BIN 2
^
In file included from /usr/lib/avr/include/avr/iotn85.h:38:0,
from /usr/lib/avr/include/avr/io.h:340,
from /usr/lib/avr/include/avr/pgmspace.h:88,
from /usr/share/arduino/hardware/arduino/cores/arduino/Arduino.h:8,
from /home/xmanj/arduino/sketchbook/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from sketch_sep03b.ino:1:
/usr/lib/avr/include/avr/iotnx5.h:55:0: note: this is the location of the previous definition
#define BIN 7
^
sketch_sep03b.ino:28:75: error: ‘NEO_KHZ400’ was not declared in this scope
Please be positive and constructive with your questions and comments.