// all of this works for the ring its just a loop and the singular neo pixels to just attach the out to in
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 6 //the signal or white wire on mine to pin 6 for the color info
// and of course conect GND to GND and Vinn or positive to 5V
//the 15 is the amount of indevidual lights so put that number in there
//the NeoPin is the pin that the signal or white wire is that we difined at the beginig
//the NEO_GRB is the type of light, GRB is most common in neo_pixles
//theres also RGBW wich is red green blue white
//and theres RGB red green blue
//the NEO_KHZ800 is the bit sream of 800 KHz(most NeoPixel products w/WS2812 LEDs)
//or you can do NEO_KHZ400 for a 400 KHz bit stream (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// were it says strip v there is the name defineing the lights so it dosent matter what it is just try to make it make sence
Adafruit_NeoPixel strip = Adafruit_NeoPixel(15, PIN, NEO_GRB + NEO_KHZ800);
float i;
float h;
float e;
void setup() {
strip.begin();//to start being able to light it up
strip.show();//updates the strip to show the colors because thes nothing it starts off
//strip.setPixelColor(7, 255, 0, 0, 127);//sets the 8th pixel to red
//strip.setBrightness(50);// this also needs to be updated by the strip.show to take effect
//strip.show();//will now show the red 8th pixle
}
void loop() {
pulseB(strip.Color(255, 0, 0), 5);//will make a red brightness pulsing light
pulseB(strip.Color(0, 0, 255), 6);//will make a blue pulsing light
pulseB(strip.Color(0, 255, 0), 7);//will make a green pulsing light
pulseC(4);// will make a red light then got to blue and then to red over and over again
}
void pulseB(uint32_t c, uint8_t a){//this function i made will pulse in brightness
for(i=50; i<200; i++){
strip.setBrightness(i);
strip.setPixelColor(a, c);
strip.show();
delay(10);
}
for(i=199; i>50; i--){
strip.setBrightness(i);
strip.setPixelColor(a, c);
strip.show();
delay(10);
}
}
void pulseC(uint8_t f){//this function i made will pulse between two colors
for(h=0; h<255; h = h + 1){
strip.setPixelColor(f, h, 0, e, 200);
strip.show();
delay(10);
}
for(e=255; e>0; e = e - 1){
strip.setPixelColor(f, h, 0, e, 200);
strip.show();
delay(10);
}
for(e=0; e<255; e = e + 1){
strip.setPixelColor(f, h, 0, e, 200);
strip.show();
delay(10);
}
for(h=255; h>0; h = h - 1){
strip.setPixelColor(f, h, 0, e, 200);
strip.show();
delay(10);
}
}
Comments
Please log in or sign up to comment.