NeoPixel Strip Blink Many LEDs

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ventolin
 
Posts: 11
Joined: Sat Aug 23, 2014 7:43 pm

NeoPixel Strip Blink Many LEDs

Post by ventolin »

Hi
So I've been trying to make a fixed amount of LEDs blink at the same time with the same color and then controll the frequency of the blinking LEDs.
Tried to to combine two sketches (Strand Test & Group of LEDs) into one with no success.

Here's what i got:

Code: Select all

#include <Adafruit_NeoPixel.h>
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(10, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
// Some example procedures showing how to display to the pixels:
  setGroup(0, strip.Color(255, 0, 0));
  setGroup(1, strip.Color(0, 255, 0));
  color(strip.Color(0, 0, 0)); // Nada
}

// Group
void setGroup(uint8_t g, uint32_t c) {
  int firstPixel = g * 5;
  for(uint8_t i=0; i<5; i++) {
    strip.setPixelColor(firstPixel + i, c);
    strip.show();
    delay(500);
  }
}

// Fill the dots one after the other with a color
void color(uint32_t c) {
  for(uint16_t j=0; j<strip.numPixels(); j++) {
    strip.setPixelColor(j, c);
  }
}
I can not make the for loop work with more than one LEDs at the same time.
¿Am i missing a function from the NeoPixel Library?

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel Strip Blink Many LEDs

Post by adafruit_support_bill »

It is not clear from your description or code what leds you want to blink and when.

As written, it looks like it will slowly light up one group of five, then slowly light up the next group;
If you can describe precisely what sequence you are trying to achieve, we might be able to help.

User avatar
ventolin
 
Posts: 11
Joined: Sat Aug 23, 2014 7:43 pm

Re: NeoPixel Strip Blink Many LEDs

Post by ventolin »

Yes, sorry.
I want to blink 30 LEDs at the same time in 4 different frequencies.
What i was trying to explain is that i don't find how to light more than one led at the same time.
Grácias.

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel Strip Blink Many LEDs

Post by adafruit_support_bill »

i don't find how to light more than one led at the same time.
In your code, you are calling strip.show(); then delay() after each call to strip.setPixelColor(). This will light each one individually with a delay in between.

You can call strip.setPixelColor() several times, then call strip.show(); That will update all of them at one time.

User avatar
ventolin
 
Posts: 11
Joined: Sat Aug 23, 2014 7:43 pm

Re: NeoPixel Strip Blink Many LEDs

Post by ventolin »

I found another post that also helped me to make a list of pixels and blink them at the same time: http://forums.adafruit.com/viewtopic.ph ... 10#p299210

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”