Rundhall
Published © CC BY-SA

Infinity Mirror Wall Clock in IKEA Picture Frame

I built an RGB LED wall clock with internet synchronization (ESP8266) and combined it with an infinity mirror.

IntermediateFull instructions provided1 hour2,848
Infinity Mirror Wall Clock in IKEA Picture Frame

Things used in this project

Hardware components

IKEA RIBBA Picture Frame Black 23cmx23cm
×1
WS2812B Led Strip,Individually Addressable Smart RGB Led Strip,Black 74pcs/1m IP30
×1
NodeMcu v3 Lua WIFI Internet of Things development MCU board ESP8266
×1
Phone charger
×1
USB phone cable
×1
Capacitor 470 µF
Capacitor 470 µF
×1
Housing for electronics
×1
Mirror 23 cm x 23 cm
×1
Glass plate 23 cm x 23 cm
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Infinity mirror wall clock in IKEA picture frame

Code

Infinity mirror wall clock in IKEA picture frame Arduino code

Arduino
/*  PIN TRANSLATIONS FOR NODEMCU ESP ***********
  
    D3 = GPIO 0  
    D10 = GPIO 1 
    D4 = GPIO 2
    D9 = GPIO 3 
    D2 = GPIO 4
    D1 = GPIO 5
    SD2 = GPIO 9
    SD3 = GPIO 10
    D6 = GPIO 12
    D7 = GPIO 13
    D5 = GPIO 14  
    D8 = GPIO 15
    D0 = GPIO 16
*/    

 unsigned int  Prev_Day, Prev_hour, Prev_minute, Prev_second, Analog_hour, PatternFlag;

#include <Ticker.h>

Ticker secondTick;

volatile int watchdog = 0;

 void ISRWatchdog(){
  watchdog++;
  if(watchdog>5)
    ESP.reset();
 }
 #include <WiFiUdp.h>
 #include <Timezone.h>   //https://github.com/JChristensen/Timezone
 #include <Wire.h>
#include <TimeLib.h>
#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>

//Cahange according your Wifi settings !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
const char *ssid = "YOUR WIFI SSID";
const char *pass = "YOUR WIFI PASSWORD";

// NTP Servers:
static const char ntpServerName[] = "us.pool.ntp.org";
//static const char ntpServerName[] = "hu.pool.ntp.org";
//static const char ntpServerName[] = "time.nist.gov";
//static const char ntpServerName[] = "time-a.timefreq.bldrdoc.gov";
//static const char ntpServerName[] = "time-b.timefreq.bldrdoc.gov";
//static const char ntpServerName[] = "time-c.timefreq.bldrdoc.gov";
const int timeZone = +100;     // Central European Time
//Central European Time (Frankfurt, Paris)
TimeChangeRule CEST = {"CEST", Last, Sun, Mar, 2, 120};     //Central European Summer Time
TimeChangeRule CET = {"CET", Last, Sun, Oct, 3, 60};       //Central European Standard Time
Timezone CE(CEST, CET);

WiFiUDP Udp;
unsigned int localPort = 8888;  // local port to listen for UDP packets

time_t getNtpTime();
void digitalClockDisplay();
void printDigits(int digits);
void sendNTPpacket(IPAddress &address);
 
unsigned long oldMilli;
unsigned long newMillis;
//unsigned long interval = 1000 * 60 * 5;   //5 perc
unsigned long interval = 1000 ;   //1 msodperc

String old_time = "00";
//String temperature;
//String humidity;
//String icon;
String result;

WiFiClient client;


    //Neopixel code is origaneted from here: https://www.instructables.com/id/NeoPixel-Clock-1/
    #define LED_OUT              13                            //  D7
    #define NumberOfLeds      60                           // total number of Neo-Pixels
    Adafruit_NeoPixel STRIP = Adafruit_NeoPixel(NumberOfLeds, LED_OUT, NEO_GRB + NEO_KHZ800);


// Color defines
    #define        red              255,0,0               //colors, green, red, blue order.....swapped red & green ?? now RGB
    #define        green          0,255,0
    #define        blue             0,0,255
    #define        black           0,0,0
    #define        grey            40,40,40
    #define        white           255,255,255
    #define        yellow          255,255,0
    #define        pale_orange    30,10,0
    #define        cyan             0,255,255
    #define        magenta      255,0,255
    #define        gold              255,160,0
    #define        orange         50,20,0  //was 20,255,0
    #define        olive             100,220,47
    #define        turq              40,245,100
    #define        lime              64,254,20
    #define        skyblue        135,206,255
    #define        purple           75,0,130
    #define        pink               255,30,12
    #define        crimson        220,3,3

    
#define BUILTIN_LED 2
unsigned char led_state = 0;

void setup() {
  STRIP.begin();                                                                                         // initialise the LED strip
  STRIP.setBrightness(200); 
  PatternFlag = 1;  
  RunPatterns();

  secondTick.attach(1,ISRWatchdog);
  Serial.begin(115200);
  pinMode(BUILTIN_LED, OUTPUT);
  digitalWrite(BUILTIN_LED, HIGH);
  led_state = 1;

  delay(10);
  Serial.println("");
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.setSleepMode(WIFI_NONE_SLEEP); 
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Wifi Connected!");
  Serial.print("IP = ");
  Serial.println(WiFi.localIP());

  oldMilli = millis();

  Udp.begin(localPort);
  setSyncProvider(getNtpTime);
  setSyncInterval(300);


}

time_t prevDisplay = 0; // when the digital clock was displayed
String prevTime = "";
int prevDay = 0;
String prevWeekDay = "";

void loop() {
  newMillis = millis();
   watchdog = 0;
  /* if (timeStatus() != timeNotSet) {
    if (minute() != prevDisplay) { //update the display only if time has changed
      prevDisplay = minute();
      digitalClockDisplay();
    }
  }*/

  if (newMillis - oldMilli > interval)
  {
      oldMilli = newMillis;
	  digitalClockDisplay();
  }
}


void digitalClockDisplay()
{
  unsigned int i, hour_pos;
  String currTime;
  String currDate;
 if(led_state==0)
      {
        digitalWrite(BUILTIN_LED, HIGH);
        led_state = 1;
      }
      else
      {
        digitalWrite(BUILTIN_LED, LOW);
        led_state = 0;
      }
  
  if(hour() < 10)
    currTime += "0";
  currTime += String(hour()) + ":";

  if(minute() < 10)
    currTime += "0";
  currTime += String(minute());
    //Display
    STRIP.setPixelColor(Prev_hour, black);                    //clear the clock of old hour, minute and second
    STRIP.setPixelColor(Prev_minute, black);
    STRIP.setPixelColor(Prev_second, black);
    if(hour() > 11) Analog_hour = hour() - 12; else  Analog_hour = hour();          //set hour to 12 hour system, 0 - 11 for analog clock
 
    for(i = 0; i < 60; i ++) {      // 5 minute markers           
        if (i % 5 == 0) STRIP.setPixelColor(i, pale_orange);
    }
  
    hour_pos = (Analog_hour * 5) + (minute() / 12);           //get to correct LED position, 1 o'clock is at 5 min mark
                                                                             //and move the hour hand every 12 minutes to simulate analog clock
                                                                      
    STRIP.setPixelColor(hour_pos, blue);                              //set the pixel for hour
    STRIP.setPixelColor(minute(), green);                               //place minute position
    STRIP.setPixelColor( second(), red);                                 //place second position
  
 /* if (minute() == hour_pos) STRIP.setPixelColor(hour_pos, magenta);                 //check for overlapping hour, minute and seconds, change color accordingly
  if (second() == hour_pos) STRIP.setPixelColor(hour_pos, blue);                        //dont show seconds over hour
  if (second() == minute()) STRIP.setPixelColor(minute(), green);         //dont show seconds over minute
*/
  Prev_hour = hour_pos;                                   //save values for clearing next time
  Prev_minute = minute();
  Prev_second = second();
  
  STRIP.show();                                //send to leds
	
	
	
  Serial.print("Time = ");
  Serial.println(currTime);
  prevTime = currTime;
}
	
	
//*******************************************************************************
// clear the strip to all black
void Clear_Strip(){
    for (int i = 0 ; i < NumberOfLeds ; i++) {
        STRIP.setPixelColor(i, black);  
     }
     STRIP.show();
}	
   

   
   const int NTP_PACKET_SIZE = 48; // NTP time is in the first 48 bytes of message
byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming & outgoing packets


time_t getNtpTime()
{
  IPAddress ntpServerIP; // NTP server's ip address

  while (Udp.parsePacket() > 0) ; // discard any previously received packets
  Serial.println("Transmit NTP Request");
  // get a random server from the pool
  WiFi.hostByName(ntpServerName, ntpServerIP);
  Serial.print(ntpServerName);
  Serial.print(": ");
  Serial.println(ntpServerIP);
  sendNTPpacket(ntpServerIP);
  uint32_t beginWait = millis();
  while (millis() - beginWait < 1500) {
    int size = Udp.parsePacket();
    if (size >= NTP_PACKET_SIZE) {
      Serial.println("Receive NTP Response");
      Udp.read(packetBuffer, NTP_PACKET_SIZE);  // read packet into the buffer
      unsigned long secsSince1900;
      // convert four bytes starting at location 40 to a long integer
      secsSince1900 =  (unsigned long)packetBuffer[40] << 24;
      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
      secsSince1900 |= (unsigned long)packetBuffer[43];

      // now convert NTP time into everyday time:
      Serial.print("Unix time = ");
      // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
      const unsigned long seventyYears = 2208988800UL;
      // subtract seventy years:
      unsigned long epoch = secsSince1900 - seventyYears;
      // print Unix time:
      Serial.println(epoch);

      TimeChangeRule *tcr;
      time_t utc;
      utc = epoch;
     
      return CE.toLocal(utc, &tcr); //Indian Time zone is +5:30 or 19800 epoch. Adjust according to your timezone
    }
  }
  Serial.println("No NTP Response :-(");
  return 0; // return 0 if unable to get the time
}

// send an NTP request to the time server at the given address
void sendNTPpacket(IPAddress &address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  packetBuffer[1] = 0;     // Stratum, or type of clock
  packetBuffer[2] = 6;     // Polling Interval
  packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  packetBuffer[12] = 49;
  packetBuffer[13] = 0x4E;
  packetBuffer[14] = 49;
  packetBuffer[15] = 52;
  // all NTP fields have been given values, now
  // you can send a packet requesting a timestamp:
  Udp.beginPacket(address, 123); //NTP requests are to port 123
  Udp.write(packetBuffer, NTP_PACKET_SIZE);
  Udp.endPacket();
}



//*************************************************************************************
//***************************************** PATTERNS ******************************

// Input a value 0 to 255 to get a color value.
// The colours are a transition g - r - b - back to g.
unsigned long Wheel( unsigned int WheelPos)
{
  if(WheelPos < 85)
    {
      return STRIP.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
    }
  else if(WheelPos < 170)
    {
      WheelPos -= 85;
      return STRIP.Color(255 - WheelPos * 3, 0, WheelPos * 3);
    }
  else
    {
      WheelPos -= 170;
      return STRIP.Color(0, WheelPos * 3, 255 - WheelPos * 3);
    }
}

//****************************************************************************
void RandomColor(unsigned int loops)
{
  long a, b, c, d;
  for (int j = 0; j < loops; j++)
    {
      for (int i = 1; i < NumberOfLeds; i ++){
          a = random(30, 256);
          b = random(30, 256);
          c = random(30, 256);
          d = random(0, NumberOfLeds - 1);
          STRIP.setPixelColor(d, a, b, c);   
        }
      delay(200);
      STRIP.show();
    }
}

//****************************************************************************
void ChaseRandom(unsigned int loops)
{
  unsigned int a, b, c, x, j;
  unsigned long new_color = 0;
  for (j = 0; j < loops; j++)
  {
    for(x = (NumberOfLeds - 1); x > 0; x--)     //First, shuffle all the current colors down one spot on the strip
      {
         STRIP.setPixelColor(x, STRIP.getPixelColor(x - 1));
      }
    a = random(1, 256);
    b = random(1, 256);
    c = random(1, 256);
    STRIP.setPixelColor(0, a, b, c);            //Add the new random color to the strip
              
    delay(100);
    STRIP.show();
   }
}

//****************************************************************************
void Fade_Strip( unsigned int greennext,  unsigned int rednext,  unsigned int bluenext,  unsigned int greenlast,  unsigned int redlast,  unsigned int bluelast,  unsigned int pos)
{
  float rlast, glast, blast, rcurr, gcurr, bcurr, rcalc, gcalc, bcalc;    //Declare Temp Variables
  float MaxTemp, MaxStep, rtemp, gtemp, btemp;
   unsigned int b, nnn, count;
  unsigned long g, temp, temp1;
  unsigned int r;

  count = 0;
  gcurr =  greenlast;
  rcurr =  redlast;
  bcurr =  bluelast;
  glast =  greennext;
  rlast =  rednext;
  blast =  bluenext;
  float x = abs(gcurr - glast);
  float y = abs(rcurr - rlast);
  if(x>y) MaxTemp = x; else MaxTemp = y;
  
 x = abs(bcurr - blast);
 if(x>MaxTemp) MaxStep = x ; else MaxStep =MaxTemp;
 
  gcalc = glast;
  rcalc = rlast;
  bcalc = blast;

  for (nnn = 0; nnn < MaxStep; nnn++)   // Calculate proportional fade rates
  {
    gtemp = (gcurr - glast) / MaxStep;
    rtemp = (rcurr - rlast) / MaxStep;
    btemp = (bcurr - blast) / MaxStep;
    gcalc = gcalc + gtemp;
    rcalc = rcalc + rtemp;
    bcalc = bcalc + btemp;
    g = gcalc;
    r = rcalc;
    b = bcalc;

    if(pos == 0)                       // Populate Faded Colors
    {
      for (count = 0; count <= NumberOfLeds; ++count)
        {
         STRIP.setPixelColor(count, g, r, b);    
        }
    }
    else
    {
        STRIP.setPixelColor(pos, g, r, b); 
    }
        STRIP.setPixelColor(pos, g, r, b); 
        delay(20);
        STRIP.show();           // Delay and Display Frame
  }
}

//****************************************************************************
void Solid_Strip( unsigned int g,  unsigned int r,  unsigned int b)
{
   unsigned int x;
  for(x = 0; x < NumberOfLeds; x ++)
   {
     STRIP.setPixelColor(x, g, r, b); 
   }
  STRIP.show(); 
}

//****************************************************************************
void InsertColor( unsigned int g,  unsigned int r,  unsigned int b)
{
  unsigned int x;
  for(x = (NumberOfLeds - 1); x > 0; x--)
    {
     STRIP.setPixelColor(x, STRIP.getPixelColor(x - 1));
    }
  STRIP.setPixelColor(0, g, r, b); 
  STRIP.show(); 
}

//****************************************************************************
void FillLeft( unsigned int g,  unsigned int r,  unsigned int b)
{
   unsigned int count;
  for(count = NumberOfLeds; count > 0; count--)
    {
      STRIP.setPixelColor(count - 1, g, r, b); 
      STRIP.show();
      delay(30);
    }
}

//****************************************************************************
void FillRight( unsigned int g,  unsigned int r,  unsigned int b)
{
   unsigned int count;
  for(count = 0; count < NumberOfLeds; count++)
    {
       STRIP.setPixelColor(count, g, r, b);  
       STRIP.show();
       delay(30);
     }
}

//****************************************************************************
//  Fill Right Any Position
void Fill_Any_PosR( unsigned int g1,  unsigned int r1,  unsigned int b1,  unsigned int g2,  unsigned int r2,  unsigned int b2,  unsigned int g3,  unsigned int r3,  unsigned int b3,  unsigned int start,  unsigned int _end)
{
    unsigned int pos;
   for(pos = start; pos < _end; pos++)
    {
      if((pos % 3) == 0) STRIP.setPixelColor(pos, g3, r3, b3); 
      if((pos % 3) == 1) STRIP.setPixelColor(pos, g2, r2, b2); 
      if((pos % 3) == 2) STRIP.setPixelColor(pos, g1, r1, b1); 
      delay(10);
      STRIP.show();
    }
}

//****************************************************************************
//  Fill Left Any Position
void Fill_Any_PosL( unsigned int g1,  unsigned int r1,  unsigned int b1,  unsigned int g2,  unsigned int r2,  unsigned int b2,  unsigned int g3,  unsigned int r3,  unsigned int b3,  unsigned int start,  unsigned int _end)
{
    unsigned int pos;
   for(pos = start; pos > _end; pos--)
    {
      if((pos % 3) == 0) STRIP.setPixelColor(pos - 1, g1, r1, b1); 
      if((pos % 3) == 1) STRIP.setPixelColor(pos - 1, g2, r2, b2); 
      if((pos % 3) == 2) STRIP.setPixelColor(pos - 1, g3, r3, b3); 
      delay(10);
      STRIP.show();
    }
}

//****************************************************************************
void Chase_3Color_Left( unsigned int g1,  unsigned int r1,  unsigned int b1,  unsigned int g2,  unsigned int r2,  unsigned int b2,  unsigned int g3,  unsigned int r3,  unsigned int b3,  unsigned int repeat)
{
   unsigned int pos, loopframe;
  int strt;
  pos = NumberOfLeds;
  for(loopframe = 0; loopframe < repeat; loopframe ++)   // Increments Led Position every ++pos
   {
     delay(150);
    STRIP.setPixelColor(pos + 2, g3, r3, b3); 
    STRIP.setPixelColor(pos + 1, g2, r2, b2); 
    STRIP.setPixelColor(pos, g1, r1, b1); 
    pos --;
    if (pos == NumberOfLeds - 3) pos = NumberOfLeds;
    for(strt = 0; strt < NumberOfLeds; strt ++)
      {
       STRIP.setPixelColor(strt, STRIP.getPixelColor(strt + 1));
      }
     STRIP.show();
   }
}

//****************************************************************************
void Chase_3Color_Right( unsigned int g1,  unsigned int r1,  unsigned int b1,  unsigned int g2,  unsigned int r2,  unsigned int b2,  unsigned int g3,  unsigned int r3,  unsigned int b3,  unsigned int repeat)
{
   unsigned int loopframe, pos;
  int strt;
  pos = 0;
  for(loopframe = 0; loopframe < repeat; loopframe++)   // Increments loopframe NumberOfLeds counts including zero
     {
     delay(150);
    STRIP.setPixelColor(pos - 0, g1, r1, b1); 
    STRIP.setPixelColor(pos - 1, g2, r2, b2); 
    STRIP.setPixelColor(pos - 2, g3, r3, b3); 
    pos ++;
     if(pos == 3) pos = 0;
     for(strt = NumberOfLeds; strt >= 0; strt --)   // Counts down from NumberOfLeds to 0
        {
          STRIP.setPixelColor(strt + 1, STRIP.getPixelColor(strt));
        }
     STRIP.show();
     }
}

//****************************************************************************
//Sets a single LED at a predefined color and position
void Fill_Dot ( unsigned int g,  unsigned int r,  unsigned int b,  unsigned int pos)
{
  STRIP.setPixelColor(pos, g, r, b);//change the color  
  STRIP.show();         
}

//****************************************************************************
void Fill_Dot_PosR ( unsigned int g,  unsigned int r,  unsigned int b,  unsigned int start,  unsigned int _end)
{
    unsigned int pos;
   for(pos = start; pos <= _end; pos++)
    {
      delay(90);
      STRIP.setPixelColor(pos, g, r, b);
      STRIP.show();
    }
}

//****************************************************************************
void Fill_Dot_PosL( unsigned int g,  unsigned int r,  unsigned int b,  unsigned int start,  unsigned int _end)
{
    unsigned int pos;
   for(pos = start; pos >= _end; pos--)
    {
      delay(90);
      STRIP.setPixelColor(pos - 1, g, r, b);
    }
    STRIP.show();
}

//*********************************************************************************
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycleLeft( unsigned int cycles)
{
  unsigned int j, i;
  for(j = 0; j < 256 * cycles; j++)
  {
    for(i = 0; i < NumberOfLeds; i++)
      {
        STRIP.setPixelColor(i, Wheel(((i * 256 / NumberOfLeds) + j) & 255));
      }
    
    STRIP.show();
  }
}

//*********************************************************************************
// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycleRight( unsigned int cycles)
{
  unsigned int j, i;
  for(j = 256 * cycles; j--;)
  {
    for(i = 0; i < NumberOfLeds; i++)
      {
        STRIP.setPixelColor(i, Wheel(((i * 256 / NumberOfLeds) + j) & 255));
      }
     
    STRIP.show();
  }
}

//***************************************************************************
void CometLeft( unsigned int g,  unsigned int r,  unsigned int b)
{
   unsigned int v;
  for(v = 0; v < NumberOfLeds; v++)
    {
      delay(60);
      STRIP.setPixelColor(v, g, r, b);
      STRIP.setPixelColor(v - 1, g / 2, r / 2, b / 2);
      STRIP.setPixelColor(v - 2, g / 4, r / 4, b / 4);
      STRIP.setPixelColor(v - 3, g / 8, r / 8, b / 8);
      STRIP.setPixelColor(v - 4, g / 16, r / 16, b / 16);
      STRIP.setPixelColor(v - 5, g / 32, r / 32, b / 32);
      STRIP.setPixelColor(v - 6, g / 64,  r/ 64, b / 64);
      STRIP.setPixelColor(v - 7, g / 128, r / 128, b / 128);
      STRIP.setPixelColor(v - 8, 0, 0, 0);
      STRIP.show();
    }
     Clear_Strip();
}

//*****************************************************************************
void CometRight( unsigned int g,  unsigned int r,  unsigned int b)
{
   unsigned int v;
  for(v = NumberOfLeds; v--;)
    {
      delay(60);
      STRIP.setPixelColor(v - 9, g, r, b);                                 
      STRIP.setPixelColor(v - 8, g / 2, r / 2, b / 2);                       
      STRIP.setPixelColor(v - 7, g / 4, r / 4, b / 4);                       
      STRIP.setPixelColor(v - 6, g / 8, r / 8, b / 8);                  
      STRIP.setPixelColor(v - 5, g / 16, r / 16, b / 16);               
      STRIP.setPixelColor(v - 4, g / 32, r / 32, b / 32);                 
      STRIP.setPixelColor(v - 3, g / 64, r / 64, b / 64);                
      STRIP.setPixelColor(v - 2, g / 128, r / 128, b / 128);        
      STRIP.setPixelColor(v - 1, 0, 0, 0);                             
      STRIP.show();
    }
}

//*****************************************************************************
void rainbow(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256; j++) {
    //
    for (i = 0; i < NumberOfLeds; i++) {
      //
      STRIP.setPixelColor(i, Wheel((i + j) & 255));
    }
    STRIP.show();
    delay(wait);
  }
}

//*****************************************************************************
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;

  for (j = 0; j < 256 * 5; j++) { // 5 cycles of all colors on wheel
    
    for (i = 0; i < NumberOfLeds; i++) {
       STRIP.setPixelColor(i, Wheel(((i * 256 / NumberOfLeds) + j) & 255));
    }
    STRIP.show();
    delay(wait);
  }
}

//*****************************************************************************
void theaterChaseRainbow(uint8_t wait) {
    unsigned int j, i;
    
  for ( j = 0; j < 256; j++) {   // cycle all 256 colors in the wheel
    for (int q = 0; q < 3; q++) {
      for ( i = 0; i < NumberOfLeds; i = i + 3) {
         STRIP.setPixelColor(i + q, Wheel( (i + j) % 255)); //turn every third pixel on
      }
      STRIP.show();
      delay(wait);
      for ( i = 0; i < NumberOfLeds; i = i + 3) {
         STRIP.setPixelColor(i + q, 0);      //turn every third pixel off
      }
    }
  }
}


//**************************************** RUN PATTERNS **************************************************************
void RunPatterns() {                            

 unsigned int counter;
 
  //blank off the date display
    
    
        
    Clear_Strip();
     if(PatternFlag == 1) {                             // check to see if this has been turned off        
        
        
        
        
        CometRight(red) ;
     }
     
    if(PatternFlag == 1) {
        
        
        
        
        CometLeft(green);
     }
     
    if(PatternFlag == 1) {
        
        
        
        
        CometRight(blue);
}

    if(PatternFlag == 1) {
        
        
        
        
        CometLeft(yellow);
    }

     if(PatternFlag == 1) {
        
        
        
        RandomColor(40);
    }

     if(PatternFlag == 1) {
        
        
        
        
        rainbowCycleRight(4);
     }
/*
    if(PatternFlag == 1) {  
        
        
        
        
        rainbowCycleLeft(4);
    }

    if(PatternFlag == 1) {                                // insert colors
    
    
    
       for(counter = 0; counter < 10; counter ++)
       {
         InsertColor(black);
         delay(90);
         InsertColor(turq);
          delay(90);
         InsertColor(magenta);
          delay(90);
         InsertColor(yellow);
          delay(90);
         InsertColor(pink);
          delay(90);
         InsertColor(red);
          delay(90);
         InsertColor(white);
          delay(90);
         InsertColor(crimson);
          delay(90);
         InsertColor(green);
          delay(90);
         InsertColor(orange);
          delay(90);
         InsertColor(blue);
          delay(90);
         InsertColor(olive);
          delay(90);
         InsertColor(purple);
          delay(90);
         InsertColor(lime);
          delay(90);
         InsertColor(skyblue);
          delay(90);
         InsertColor(gold);
          delay(90);
       }
    }  
   
    if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(red, 0, 66);
    }

    if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(white, 11, 55);
    }

     if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(blue, 22, 44);
     }
    delay(2000);
    
    if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(yellow, 0, 66);
    }

    if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(pink, 0, 25);
     }

     if(PatternFlag == 1) {
        
        
        
        
        Fill_Dot_PosR(lime, 35, 55);
     }

    if(PatternFlag == 1) {
        
        
        
        Solid_Strip(yellow);
    }

     if(PatternFlag == 1) {
        
        
        
        Solid_Strip(gold);
    }

    if(PatternFlag == 1) {
        
        
        
        Solid_Strip(pink);
    }

     if(PatternFlag == 1) {
        
        
        
        Solid_Strip(lime);
     }

    if(PatternFlag == 1) {
        
        
        
        Solid_Strip(red);
    }

    if(PatternFlag == 1) {
        
        
        
        Solid_Strip(turq);
    }

     if(PatternFlag == 1) {
        
        
        
        ChaseRandom(25);
     }

    if(PatternFlag == 1) {
        
        
        
        RandomColor(10);
    }

    if(PatternFlag == 1) {
        
        
        
        
        rainbowCycleRight(4);
    }

    if(PatternFlag == 1) {
        
        
        
        
        rainbowCycleLeft(4);
    }

   if(PatternFlag == 1) {
        
        
        
        FillLeft(red);
    }

    if(PatternFlag == 1) {
        
        
        
        
        FillRight(purple);
    }

    if(PatternFlag == 1) {
        
        
        
        FillRight(green);
    }

     if(PatternFlag == 1) {
        
        
        
        
        FillLeft(crimson);
     }

    if(PatternFlag == 1) {
        
        
        
        FillLeft(blue);
    }

    if(PatternFlag == 1) {
        
        
        
        
        FillRight(orange);
    }

    if(PatternFlag == 1) {
        
        
        
        FillLeft(lime);
    }

    if(PatternFlag == 1) {
        
        
        
        
        FillRight(magenta);
    }

    if(PatternFlag == 1) {
        
        
        
        
        Chase_3Color_Right(blue, orange, lime, NumberOfLeds);
    }

    if(PatternFlag == 1) {
        
...

This file has been truncated, please download it to see its full contents.

Credits

Rundhall

Rundhall

6 projects • 5 followers
Thanks to ItsGraGra .

Comments