Glow Scarf Code

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

Just define your own color palette with the colors you want.

You can't use the buttons on the Gemma itself for controlling brightness. You would have to add buttons for that. There aren't enough free pins to add two buttons. You could only add one button.

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

If I see a line of original code then the same line altered with a new color it will help me understand what to change.

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

I have been able to change the colors for the Cortana code but when I slow down the animation by increasing the delay value I wish it was smoother.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

How did you change the delay? You should update the symbol SPEED to a higher number
You might also change the STEPS value to 1 to make it a little smoother:

Code: Select all

#define SPEED       10   // How fast the colors move.  Higher numbers = faster motion
#define STEPS        2   // How wide the bands of color are.  1 = more like a gradient, 10 = more like stripes

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

Thank you so much Rick. I am grateful every time you help me. Here is the Cortana code I altered.

Code: Select all

//Cortana costume animating NeoPixels
//based on the Larson Scanner Shades by Phillip Burgess
//https://learn.adafruit.com/larson-scanner-shades
//modified by Becky Stern for Adafruit
#include <Adafruit_NeoPixel.h>

#define PIN 1
#define SPEED       70   // How fast the colors move.  Higher numbers = faster motion
#define STEPS        10   // How wide the bands of color are.  1 = more like a gradient, 10 = more like stripes
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino 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(21, PIN, NEO_GRB + NEO_KHZ800);

int ringRightSide[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
int ringLeftSide[] = {0, 15, 14, 13, 12, 11, 10, 9, 8};
int singlePixels[] = {16, 17, 18, 19, 20};

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

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

int pos = 0;
int pos2 = 0;

void loop() {
    // Draw 5 pixels centered on pos.  setPixelColor() will clip any
  // pixels off the ends of the strip, we don't need to watch for that.
  strip.setPixelColor(ringRightSide[abs((pos - 2)%9)], strip.Color(140, 10, 140)); // Dark color
  strip.setPixelColor(ringRightSide[abs((pos - 1)%9)], strip.Color(175, 40, 175)); // Medium color
  strip.setPixelColor(ringRightSide[abs((pos    )%9)], strip.Color(70,0,200)); // Center pixel is brightest
  strip.setPixelColor(ringRightSide[abs((pos + 1)%9)], strip.Color(175, 40, 175)); // Medium color
  strip.setPixelColor(ringRightSide[abs((pos + 2)%9)], strip.Color(70,0,200)); // Dark color

  
    strip.show();
  delay(250);
  
    // Rather than being sneaky and erasing just the tail pixel,
  // it's easier to erase it all and draw a new one next time.
  for(int j=-2; j<= 2; j++) {
    strip.setPixelColor(ringRightSide[(pos+j)%9], 0);
    strip.setPixelColor(ringLeftSide[(pos+j)%9], 0);
    strip.setPixelColor(singlePixels[(pos2+j)%5], 0);
  }
  

  pos += 1;
  if(pos < 0) {
    pos = 1;

  } else if(pos >= 9) {
    pos = 0;

  }

  pos2 += 1;
  if(pos2 < 0) {
    pos2 = 1;
  } else if(pos2 >= 6) {
    pos2 = 0;

  }

}

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

Now that V1 is assembled I can make better adjustments for V2. V2 Aeon worm will be covered in french knot BANNED that will make the design more interesting and give the illumination more nuance.

https://www.youtube.com/watch?v=mGNSzQl ... e=youtu.be
https://www.youtube.com/watch?v=S4NNhulP_OE

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

Nice work! Looks good!

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

In addition two the current animation I would like the current animation to cycle through a different set of colors. If possible I want to add one or two different animation styles as well. I want to create a more elaborate dance of colors.

Example
1. Standard Cortana
2. Lights Fade in and out in unison.
3. Lights stay on then repeat 1. 2. 3.

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

I would like all the lights to remain on at a dim setting and have brighter value pulse move across them.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

You might want to post this in our Jobs board:
https://www.adafruit.com/jobs

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

Can the Fur Scarf code be changed so that instead of the colors changing in unison they change sequentially from the gemma?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

Not sure what you mean by 'change sequentially'. You want a different color on each pixel?
I think the RainbowColors_p palette already does that, doesn't it?

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

Like the animation from the youtube video Animated Glow Fur Scarf. The default code doesn't have a flowing animation. The lights change color altogether at the same time.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Glow Scarf Code

Post by adafruit_support_rick »

According the the tutorial, you just adjust the STEPS constant to make it crawl. Does that not work?

User avatar
jeremyzschau
 
Posts: 130
Joined: Fri Feb 27, 2015 11:00 pm

Re: Glow Scarf Code

Post by jeremyzschau »

Yes, that worked. I am sorry it has been awhile. I ran out of conductive thread and had to order more. I am in Japan and it takes time to receive from America. Is there code to reverse the direction the lights change color?

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

Return to “Arduino”