2

I am working on wearable project using an Adafruit Flora V2, and for this project I need to use the onboard NeoPixel. I also need to use Neopixels that are attached to the D6 pin (is it a pin?). I have a line at the beginning of my program that says #define PIN 6. I found that I can use the onboard NeoPixel by changing this to #define PIN 8. Is there a way to use the onboard NeoPixel and the ones attached to D6. I already have everything wired up, and the rest of my program is written, I just need to use both pins. Thanks for any possible help.

  • using Flora v2? – ARK Apr 20 '16 at 19:24
  • @ARK Yes, edited – kungfushark Apr 20 '16 at 19:26
  • Do you have external Neopixels attached to D6. Because, Adafruit Flora v2 has only one on-board Neopixel and that is internally attached to pin 8? – ARK Apr 20 '16 at 19:30
  • Yes, my external NeoPixels are attached to D6. – kungfushark Apr 20 '16 at 20:22
2

The #define is just letting you use a nice name for the numeric value of the pin. If you want to use two different pins, you use two different names.

So you might define them at the beginning something like:

#define BOARDLED 8
#define STRIPLED 6

Then you create a NeoPixel object that uses that pin. In your case, you'll do this twice.

Adafruit_NeoPixel flora_led = Adafruit_NeoPixel(60, BOARDLED, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, STRIPLED, NEO_GRB + NEO_KHZ800);

And then you call the one you want to set/modify/show/etc.

strip.show();
flora_led.show();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.