Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #define LED_COUNT 240
- #define PIN 8
- // 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(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);
- int potPin = 2; // select the input pin for the potentiometer
- int val = 0; // variable to store the value coming from the sensor
- void setup() {
- // strip.setBrightness(50);//THIS WORKS!!!
- strip.begin();
- strip.show(); // Initialize all pixels to 'off'
- }
- void modeFireplace(){
- uint8_t iRandom = 0;
- for(int iRow = 0; iRow<8; iRow++){//not sure what this number do I think it changes initial groups/groupings
- for(int iCol = 0; iCol<8; iCol++){
- //changing the icol # changings groupings
- for(int iBlank = 0; iBlank < strip.numPixels(); iBlank++){strip.setPixelColor(iRow+(iCol*10), 0,0,0);}
- //expand teh number after icol* as you add pixels
- iRandom = random(1,200);//note random 1-100
- //colors here are listed R,G,B
- //changing the number after iRandom > results in blink rate change
- if (iRandom > 195){strip.setPixelColor(iCol, 0, random (150,255),0);}//randomn flash green 1-5
- if (iRandom > 197){strip.setPixelColor(5+iCol, random(150,255), 0,0);}//random flash red 6-8
- if (iRandom > 195){strip.setPixelColor(8+iCol, 0, 0, random(150,255));}//random flash blue 9-15
- if (iRandom > 193){strip.setPixelColor(13+iCol, random(100,255), 0, 0);}//13-17 red
- if (iRandom > 94){strip.setPixelColor(16+iCol, 0, 0, random(100,255));}//18-21 blue
- if (iRandom > 95){strip.setPixelColor(22+iCol, 0, random (0,255),0);}//22-26
- if (iRandom > 97){strip.setPixelColor(27+iCol, random(10,255), 0,0);}//27-31
- if (iRandom > 85){strip.setPixelColor(32+iCol, 0, 0, random(15,255));}//32-36
- if (iRandom > 93){strip.setPixelColor(37+iCol, random(10,255), 0, 0);}//37-41
- if (iRandom > 74){strip.setPixelColor(42+iCol, 0, 0, random(100,255));}//42-46
- if (iRandom > 125){strip.setPixelColor(47+iCol, 0, random (150,255),0);}//randomn flash green 1-5
- if (iRandom > 170){strip.setPixelColor(52+iCol, random(150,255), 0,0);}//random flash red 6-8
- if (iRandom > 150){strip.setPixelColor(57+iCol, 0, 0, random(150,255));}//random flash blue 9-15
- if (iRandom > 183){strip.setPixelColor(62+iCol, random(10,255), 0, 0);}//13-17 red
- if (iRandom > 144){strip.setPixelColor(67+iCol, 0, 0, random(100,255));}//18-21 blue
- //if (iRandom > 95){strip.setPixelColor(13+iCol, 200, random(0,2), 255);}
- //if (iRandom > 98){strip.setPixelColor(15+iCol, 255, random(200,255), 255);}
- delay(.5);
- }
- }
- strip.show();
- }
- void loop() {
- val = analogRead(potPin); // read the value from the sensor
- strip.setBrightness(val);//THIS WORKS!!!
- modeFireplace();
- }
Advertisement
Add Comment
Please, Sign In to add comment