Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //************************************************************************
- //*** Code by: spyclub ***************************************************
- //***https://www.instructables.com/Arduino-Controlled-Electric-Candle/****
- //***https://www.thingiverse.com/thing:4640101****************************
- //************************************************************************
- #include <Adafruit_NeoPixel.h>
- #define DELAY_MULTIPLER 50
- #define PIN 1
- Adafruit_NeoPixel strip = Adafruit_NeoPixel(12 , PIN, NEO_GRB + NEO_KHZ800);
- void setup() {
- strip.begin();
- strip.show();
- }
- void loop()
- {
- fire(1,random(50,500));
- }
- void fire(uint8_t wait, uint8_t times)
- {
- for(uint16_t t=0; t < times; t++)
- {
- uint32_t cBaseYellow = strip.Color(255, 100, 10);
- uint32_t redFilcker = strip.Color(255, 40, 0);
- uint32_t blueFilcker = strip.Color(255, 100, 100);
- for(uint16_t i=0; i<strip.numPixels(); i++)
- {
- strip.setPixelColor(i, cBaseYellow);
- }
- uint8_t blue;
- for(uint16_t i=0; i<1; i++)
- {
- blue = random(1,strip.numPixels());
- strip.setPixelColor(blue, blueFilcker);
- }
- uint8_t red;
- for(uint16_t i=0; i<4; i++)
- {
- red = random(1,strip.numPixels());
- strip.setPixelColor(red, redFilcker);
- }
- strip.show();
- delay(wait*DELAY_MULTIPLER);
- }
- }
Add Comment
Please, Sign In to add comment