0

FLORA PROGRAM
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FLORA PROGRAM

by crusaderabbit on Sat Aug 12, 2017 1:12 pm

Hi, Thanks for looking at my post.
I am a fashion student at Mess College in San Diego. I have an instructor who threw a bunch of Floras and Neo-pixels at us and wants us to make things with them. She doesn't know how to solder or program a Flora, but for some reason we are expected to make this work. I have been grappling with this for a few semesters now but I still get stuck on things and if it wasn't for this forum I'd be lost.
Right now I am putting one single neo-pixel behind a fabric flower on a hat. I want it to change color to match the outfit.
I wrote a program for this trying to use existing code from other projects that you have. After some messing around I came up with something that compiled and uploaded onto my Flora. I know a Flora is probably overkill for this but it is what I have.
Anyway, when I connected it to a neo-pixel (actually a string of 11 neo-pixels that I already had wired) nothing happened. I'm pretty sure it's the code. Could someone please take a look at this and see if they can find the problem.
The program is intended to make the neo-pixel change from orange to yellow, to red, to white, 15 seconds for each color, then to rest for 1 minute and start over.
The code:

#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, PIN, NEO_RGB + NEO_KHZ400);

void setup () {
strip.begin ();
strip.show ();
}

void loop () {
(strip.Color (255,102,51), 15000); //orange

(strip.Color (245,255,51), 15000);
//yellow

(strip.Color (224,53,25), 15000;
//Red

(stripColor (255,255,255), 15000);
// white

delay (60000);
}

That's it. I think I would like to be able to adjust the brightness of each color individually also, which I did not incorporate into the above code. Thank you.

crusaderabbit
 
Posts: 80
Joined: Wed Apr 13, 2016 1:55 pm

Re: FLORA PROGRAM

by crusaderabbit on Sat Aug 12, 2017 1:40 pm

PS. It appears that I will need to use a v2 neo-pixel for this project. Are the only adjustments to the code
NEO_GRB + NEO_KHZ800
and then list the colors in Green-Red-Blue order?

crusaderabbit
 
Posts: 80
Joined: Wed Apr 13, 2016 1:55 pm

Re: FLORA PROGRAM

by caitlinsdad on Sat Aug 12, 2017 3:09 pm

The easiest way to get the hang of coding for neopixels is to start off with one of the demo sketches found in the IDE menu(File,Examples,Adafruit Neopixels...). Use the Simple code.
Change the numbers to reflect which pin you soldered the data line to and the number of neopixels connected on the line.
Change the delay value to your 15 seconds.
The loop section is where you code in what you want it to do.
Your syntax looked odd, I don't know if there is a function to assign a whole strip one color at once so you have to FOR loop it to assign the color for each neopixel.
Once you change or assign a new color, the strip.show() function is called to make it display the new colors.
Then you delay it for 15 seconds.
Repeat the code lines to set the new color, strip.show(); (the example code uses "pixels" as the defined object instead of "strip") and do a delay.
Do as many color changes as you need, end it with the final one minute delay before it loops back again to the first color change.

Don't get too hung up on that v2 neo-pixel, see what definition works and see what colors are displayed, adjust and run with it.
Good luck.

caitlinsdad
 
Posts: 393
Joined: Fri Feb 24, 2012 4:23 pm

Re: FLORA PROGRAM

by crusaderabbit on Sat Aug 12, 2017 3:15 pm

Thanks again!

crusaderabbit
 
Posts: 80
Joined: Wed Apr 13, 2016 1:55 pm

Re: FLORA PROGRAM

by caitlinsdad on Sat Aug 12, 2017 3:18 pm

oh, strip.Color (255,102,51) is a function that only gives you that weird 32-bit RGB color number. R,G,B color values are on a range of 0-255. You vary intensity by lowering those numbers. So for a simulated fade effect you halve all the numbers again and again in a loop. There is also a thing called gamma correction which adjusts for the fact eyes see colors/brightness in a different way. The general strip.setBrightness(100); command should only be used in the setup since it affects the entire strip and somehow not good when used many times in a sketch. Good luck.

caitlinsdad
 
Posts: 393
Joined: Fri Feb 24, 2012 4:23 pm

Please be positive and constructive with your questions and comments.