coding pixel strip

by matt_aus on Mon Oct 21, 2013 12:23 am

#include <Adafruit_NeoPixel.h>

#define PIN 6
Hi
I am really enjoying the neo pixel strip!
I am trying to get as much info about coding the strip to create lots of effects

with the strandtest i love the single chase of colours.
but when i just want to loop this effect i cannot get it to work? (below code)

also how do i add more various colours e.g: light purple?

Thanks

Is there a place where i can get sample codes? or can you advise how i can program
Code: Select all | TOGGLE FULL SIZE
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

Adafruit_NeoPixel strip = Adafruit_NeoPixel(27, 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:
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
  rainbow(20);
  rainbowCycle(20);
}
Last edited by adafruit_support_bill on Mon Oct 21, 2013 5:23 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.
matt_aus
 
Posts: 9
Joined: Sun Sep 29, 2013 4:06 am

Re: coding pixel strip

by adafruit_support_bill on Mon Oct 21, 2013 5:31 am

with the strandtest i love the single chase of colours.
but when i just want to loop this effect i cannot get it to work? (below code)

Not sure which effect it is that you like, but try commenting out one line at a time in the 'loop()' function of strandtest. You should be able to eliminate all except for the one you want to keep.


There is a library reference for the neopixel library here: http://learn.adafruit.com/adafruit-neop ... no-library
And there are lots of projects with example code to follow in the learning system: http://learn.adafruit.com/search?q=neopixel
User avatar
adafruit_support_bill
 
Posts: 28227
Joined: Sat Feb 07, 2009 9:11 am

Re: coding pixel strip

by matt_aus on Sun Oct 27, 2013 8:58 pm

Hi,
Thanks for the links - had a look at all of them.
this is the code i'm working with:
Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_NeoPixel.h>

#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, 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:
  colorWipe(strip.Color(255, 0, 0), 50); // Red
  colorWipe(strip.Color(0, 255, 0), 50); // Green
  colorWipe(strip.Color(0, 0, 255), 50); // Blue
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

I understand the colour wipe section and the vales make the RGB change.
but its this bit that i am having trouble understanding?

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}


How for example would i get the strip to run a few colour wipes and then move back in the opposite direction
and then move to a different pattern?
I can't work out how to loop for a exact amount of time?

Thanks
Last edited by adafruit_support_bill on Mon Oct 28, 2013 5:16 am, edited 1 time in total.
Reason: Please use the 'code' button when submitting code - click 'code' and paste your code between the tags.
matt_aus
 
Posts: 9
Joined: Sun Sep 29, 2013 4:06 am

Re: coding pixel strip

by EternalCore on Sun Oct 27, 2013 10:45 pm

Hi, Here use my example to help understanding lighting directions [Example]NeoPixel Strip Scrolling Cylon Eye!: http://goo.gl/4RzWQQ
Things I've Made Here:
1.[101-Help]~12v -> 5v 1.5A Regulated Power For NeoPixels.: http://goo.gl/uMXuk7
2.[Example]NeoPixel Strip Scrolling Cylon Eye!: http://goo.gl/4RzWQQ
User avatar
EternalCore
 
Posts: 239
Joined: Tue Jul 30, 2013 2:57 pm
Location: Canada