Anas Mo
Published

Programable LEDstrip Module 1.0, 2.0

A LED strip development multipurpose module

IntermediateWork in progress3 hours3,383
Programable LEDstrip Module 1.0, 2.0

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
1838B IR Infrared Receiving Head
×1
WS2812B led strip
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Resistor 1k ohm
Resistor 1k ohm
×3
IR Remote
×1
Custom PCB
×1
female single-row pin header
×1

Software apps and online services

Arduino IDE
Arduino IDE
Visual Studio 2015
Microsoft Visual Studio 2015

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Vernier Caliper

Story

Read more

Code

LEDstrip

C/C++
Code used for version 2
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <Adafruit_NeoPixel.h>
#include <ezButton.h>

ezButton buttonUp(7);
ezButton buttonDown(8);
ezButton buttonMode(9);
unsigned long M_button_pressed;
unsigned long M_button_released;

#define Button0  0xFF6897
#define Button1  0xFF30CF
#define Button2  0xFF18E7
#define Button3  0xFF7A85
#define Button4  0xFF10EF
#define Button5  0xFF38C7
#define Button6  0xFF5AA5
#define Button7  0xFF42BD
#define Button8  0xFF4AB5
#define Button9  0xFF52AD
#define Bhun  0xFF9867
#define B200  0xFFB04F
#define Bplus  0xFFA85F
#define Bminus  0xFFE01F
#define Bchplus 0xFFE21D
#define Beq 0xFF906F
#define Bright 0xFF02FD
#define Bleft 0xFF22DD
#define Bplay 0xFFC23D
#define Bchminus 0xFFA25D
#define Bch 0xFF629D

#define PIN 6 
#define NUMPIXELS 30
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int RECV_PIN = 5;
IRrecv irrecv(RECV_PIN);
decode_results results;

long int CODES[21] = {Button0, Button1, Button2, Button3, Button4, Button5,                            Button6, Button7, Button8, Button9, Bhun, B200, Bplus,                           Bminus, Bchplus, Beq, Bright, Bleft, Bplay, Bchminus,                             Bch};
long int NewCodes[21];
long int NewCode;
int N = 0;
String data;
char d;
int buttonshift = 0;

bool modeloop = true;
int R = 0;
int G = 0;
int B = 255;

int sensorPin = A0;
int Compare[2]; 
int i = 0;
int SoundInBoosted;
int sensitivity = 1;
int SoundInterval = 50;
bool soundmode = true;
int soundmodecall = 0;

int interval = 100;
unsigned long previousMillis = 0;
unsigned long currentMillis = 0;

void setup() {
  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  buttonUp.setDebounceTime(50); 
  buttonDown.setDebounceTime(50);
  buttonMode.setDebounceTime(50); 
}


void loop() {
    
      unsigned long currentMillis = millis();
      if (currentMillis - previousMillis >= 100) {
        previousMillis = currentMillis;
        findCode();
      }    
}
//=============================================================================//======= COLORS ==============================================================//================================

 
void ColorFadeFunction(bool r, bool g, bool b, bool UpOrDown, int L_1, int L_2, int counter){ // only one at time
  if(UpOrDown == true){
      if(r == true){
        if(R<L_2){R+=counter;}
        else {R = L_1;}
      }else if(g == true){
          if(G <L_2){G+=counter;}
          else{G = L_1;}
      }else if(b == true){
          if(B <L_2){B+=counter;}
          else{B = L_1;}
       }
  }
  if(UpOrDown == false){
      if(r == true){
        if(R>=L_1){R-=counter;}
        else {R = L_2;}
      }else if(g == true){
          if(G>=L_1){G-=counter;}
        else {G = L_2;}
      }else if(b == true){
          if(B>=L_1){B-=counter;}
        else {B = L_2;}
       }
  }
  
}





//=================================================================================LED SOUND FUNCTIONS======================================================================================

void SoundMode(){
  
  soundmode = true;
  while(soundmode){
    buttonUp.loop(); 
    buttonDown.loop();
    buttonMode.loop(); 
    int inputValue = analogRead(sensorPin);
    Compare[i] = inputValue;
    i++;

  
    if(i>1)
    {
     SoundInBoosted = abs(Compare[0] - Compare[1]) * sensitivity;
     Serial.print("Input Modified difference: ");
     Serial.print(SoundInBoosted);
     Serial.print(", ");
     Serial.print("Sensitivity: ");
     Serial.print(sensitivity);
     Serial.print(", ");
     Serial.print("count: ");
     Serial.print(soundmodecall);
     Serial.print(", ");
     Serial.print("Threshold: ");
     Serial.println(inputValue);
     SoundModeList(soundmodecall,SoundInBoosted);
     i = 0;
    }  
  
    if(buttonUp.isPressed()){
      Serial.println("The button Up is pressed");
      if(sensitivity <= 201){
        sensitivity += 5;
      }
    }
  
    if(buttonDown.isPressed()){
      Serial.println("The button Down is pressed");
      if(sensitivity > 1){
        sensitivity -= 5;
      }
    }

  if(buttonMode.isPressed()){
      Serial.println("mode button pressed");
      M_button_pressed = millis();
  }else if(buttonMode.isReleased()){
    M_button_released = millis();
    if(M_button_released - M_button_pressed >= 3000)
    {
      Serial.println("Go to Remote mode");
      soundmode = false;
    }else{
        if(soundmodecall < 6){
          soundmodecall++;
        }else{
          soundmodecall = 0;
        }
     }
  }
      
    delay(SoundInterval);
    }
}


//=========================================================================LED REMOTE FUNCTIONS=================================================================================

void findCode() {
  buttonMode.loop();
  buttonUp.loop();
  buttonDown.loop();
  if (irrecv.decode(&results)) 
  {
    if (exist(results.value, CODES, 21)) 
    {
      LEDMODE(results.value); // calls mode
    }
    else if (exist(results.value, NewCodes, 21)) 
    {
      NewInBtn(results.value, NewCodes, 21);
    }
    irrecv.resume(); 
       
  }else if (Serial.available() > 0){
    SerialIn();
    }
  
  if(buttonMode.isPressed()){
      Serial.println("mode button pressed");
      M_button_pressed = millis();
  }else if(buttonMode.isReleased()){
    M_button_released = millis();
    if(M_button_released - M_button_pressed >= 3000){
      Serial.println("Go to sound mode");
      SoundMode();
      }else{
        if(buttonshift < 18){
          buttonshift++;
        }else{
          buttonshift = 0;
        }
        ButtonSwitch(buttonshift);
     }
  }
  
  if(buttonUp.isPressed()){
      if(interval <= 300){
       Serial.println("Interval up");
        interval += 50;}
  }else if(buttonDown.isPressed()){
      if(interval > 50){
        Serial.println("Interval down");
        interval -= 50;
      }
    }
}

int exist(long int compareValue, long int arrayName[], int arraySize) {
  irrecv.resume();
  for (int x = 0; x < arraySize; x++) {
    if (arrayName[x] == compareValue) {
      return true;
    }
  }
  return false;
}

void upinterval()
{
  if(interval<300){
      interval+=50;
  }
}

void downinterval()
{
 if(interval>100)
    interval-=100; 
}

//=========================================================================LED SERIAL FUNCTIONS==================================================================================

void IR_NewBtn(int N) // 
{
  bool newloop = true;
  while(newloop)
  {
    if (irrecv.decode(&results)) 
    {
     NewCode = results.value;
     NewCodes[N] = NewCode;
     newloop = false;
    }
    delay(100);
  }
  
  irrecv.resume();
  for(int x=0;x<=10;x++)
  {
  Serial.println("Z"); // not working
  delay(200);
  }
 
}

void setRGB(String x)
{
  String rstring = " ";
  String gstring = " ";
  String bstring = " ";

  rstring = x.substring(0,3);
  gstring = x.substring(3,6);
  bstring = x.substring(6);

  R = rstring.toInt();
  G = gstring.toInt();
  B = bstring.toInt();
  
}

//=========================================================================LED MODE LISTS========================================================================================

void SoundModeList(int count, int soundinput)
{
    switch(count){

              case 0: LEDSoundResponse_blue(soundinput);
                       break;
                        
              case 1: LEDSoundResponse_red(soundinput);
                        break;

              case 2: LedMidSoundResponse_red(soundinput);
                        break;

              case 3: LedMidSoundResponse_blue(soundinput);
                        break;

               case 4: SoundLEDFlash(soundinput);
                        break;

              case 5: SoundRedFade(soundinput);
                        break; 

              case 6: Sound_blinkingstar(soundinput);
                            break;

    }
}



void LEDMODE(long int code)
{ 
  irrecv.resume();
  switch(code){
              case Button0: R = 255;
                            G = 255;
                            B = 255;
                            whitejump();
                            break;
              
              case Button1: redneonmove();   
                            break;
              
              case Button2: blueneonmove();
                            break;
              
              case Button3: greenmove();
                            break;
              
              case Button4: redflash();
                            break;
              
              case Button5: B = 255;
                            blueflash();
                            break;
              
              case Button6: redsplitmove();
                            break;
              
              case Button7: bluesplitmove();
                            break;
              
              case Button8: B = 255;
                            redyellowsplitmove();
                            break;
              
              case Button9: redblueflash();
                            break;
                
              case Bhun: chasing();
                         break;
              
              case B200: beam();
                         break;

              case Beq: beamV2();
                        break;
              
              case Bchplus: kill();
                            break;

              case Bplus: upinterval();
                          break;

              case Bminus: downinterval();
                           break;

              case Bright: purpledot();
                           break;

              case Bplay: splitpaintmove();
                           break;

              case Bchminus: Colorfade();
                             break;

              case Bch: Fadingblueneon();
                        break;

              case Bleft: blinkingstar();
                          break;
                           
        }
}


void SerialIn()
{
  String x;  
  if(Serial.available())
  {
    data = Serial.readString();
    d = data.charAt(0);
    switch(d){

              case '0': kill();
                        break;
                        
              case '1': Colorfade();
                        break;

              case '2': Fadingblueneon();
                        break;

              case '3': splitpaintmove();
                        break;

               case '4': blinkingstar();
                        break;

              case '5': purpledot();
                        break;

               case '6': beamV2();
                        break;
                        
               case '7': chasing();
                         break;

               case '8': beam();
                         break;
                        
              case '9': whitejump();
                            break;
              
              case 'A': redneonmove();   
                            break;
              
              case 'B': blueneonmove();
                            break;
              
              case 'C': greenmove();
                            break;
              
              case 'D': redflash();
                            break;
              
              case 'E': blueflash();
                            break;
              
              case 'F': redsplitmove();
                            break;
              
              case 'G': bluesplitmove();
                            break;
              
              case 'H': redyellowsplitmove();
                            break;
              
              case 'I': redblueflash();
                            break;
              
              case 'S': x = data.substring(1);
                        interval = x.toInt();
                        break;

               case 'R': x = data.substring(1);
                         setRGB(x);
                         break;

             case 'N':  x = data.substring(1);
                        N = x.toInt();
                        IR_NewBtn(N); 
                        break;         
                                    
        }    
  }
}

void NewInBtn(long int compareValue, long int arrayName[], int arraySize)
{
  int z;
  for (int x = 0; x < arraySize; x++) {
    if (arrayName[x] == compareValue) {
      z = x;
    }
  }

    switch(z){

              case 0: kill();
                        break;
                        
              case 1: Colorfade();
                        break;

              case 2: Fadingblueneon();
                        break;

              case 3: splitpaintmove();
                        break;

               case 4: blinkingstar();
                        break;

              case 5: purpledot();
                        break;

               case 6: beamV2();
                        break;
                        
               case 7: chasing();
                         break;

               case 8: beam();
                         break;
                        
              case 9: whitejump();
                            break;
              
              case 10: redneonmove();   
                            break;
              
              case 11: blueneonmove();
                            break;
              
              case 12: greenmove();
                            break;
              
              case 13: redflash();
                            break;
              
              case 14: blueflash();
                            break;
              
              case 15: redsplitmove();
                            break;
              
              case 16: bluesplitmove();
                            break;
              
              case 17: redyellowsplitmove();
                            break;
              
              case 18: redblueflash();
                            break;
                                    
        }
    
}

void ButtonSwitch(int z)
{
    switch(z){

              case 0: kill();
                        break;
                        
              case 1: Colorfade();
                        break;

              case 2: Fadingblueneon();
                        break;

              case 3: splitpaintmove();
                        break;

               case 4: blinkingstar();
                        break;

              case 5: purpledot();
                        break;

               case 6: beamV2();
                        break;
                        
               case 7: chasing();
                         break;

               case 8: beam();
                         break;
                        
              case 9: whitejump();
                            break;
              
              case 10: redneonmove();   
                            break;
              
              case 11: blueneonmove();
                            break;
              
              case 12: greenmove();
                            break;
              
              case 13: redflash();
                            break;
              
              case 14: blueflash();
                            break;
              
              case 15: redsplitmove();
                            break;
              
              case 16: bluesplitmove();
                            break;
              
              case 17: redyellowsplitmove();
                            break;
              
              case 18: redblueflash();
                            break;
                            
                                    
        }
    
}

//=========================================================================LED SOUND MODES========================================================================================

void LEDSoundResponse_red(int x){
  pixels.clear();
  int limit = x / (1000 / NUMPIXELS);
  B = 0;
  G = 0;
  R = 1;
  for(int i=0;i<=limit;i++){
       if(R>=100){G += 10;}
       pixels.setPixelColor(i, pixels.Color(R, G, B));
       pixels.show();
       R += 8;       
       }
}

void LEDSoundResponse_blue(int x){
  pixels.clear();
  int limit = x / (1000 / NUMPIXELS);
  G = 0;
  B = 1;
  R = 0;
  for(int i=0;i<=limit;i++){
       if(B>=100){R += 10;}
       pixels.setPixelColor(i, pixels.Color(R, G, B));
       pixels.show();
       B += 8;       
       }
}

void LedMidSoundResponse_red(int x){
  pixels.clear();
  int limit = x / (500 / NUMPIXELS);
  G = 0;
  R = 1;
  for(int i=0;i<=limit;i++){
       if(R>=100){G += 10;}
       pixels.setPixelColor((NUMPIXELS/2)+i, pixels.Color(R, G, B));
       pixels.setPixelColor((NUMPIXELS/2)-i, pixels.Color(R, G, B));
       pixels.show();
       R += 16;       
       }
}

void LedMidSoundResponse_blue(int x){
  pixels.clear();
  int limit = x / (500 / NUMPIXELS);
  G = 0;
  B = 1;
  R = 0;
  for(int i=0;i<=limit;i++){
       if(B>=100){R += 10;}
       pixels.setPixelColor((NUMPIXELS/2)+i, pixels.Color(R, G, B));
       pixels.setPixelColor((NUMPIXELS/2)-i, pixels.Color(R, G, B));
       pixels.show();
       B += 16;       
       }
}


void SoundLEDFlash(int x){
  
  if(x<=10){
    R = 0;
    B = 0;
    G = 255;
  }else if(x>10 && x<=75){
    R = 0;
    G = 255;
    B = 255;
  }else if(x>75 && x<=200){
    B = 0;
    R = 255;
    G = 255;
  }else if(x>200 && x<300){
    R = 0;
    G = 0;
    B = 255;
  }else if(x>300 && x<=400){
    G = 0;
    R = 255;
    B = 255;
  }else if(x>400){
    G = 0;
    B = 0;
    R = 255;
  }

  for(int i=0;i<NUMPIXELS;i++){
       pixels.setPixelColor(i, pixels.Color(R, G, B));}
   pixels.show();
}

void SoundRedFade(int x){
  B = 0;
  G = 0;
  if(x<=10){
    R = 5;
  }else if(x>10 && x<=75){
    R = 50;
  }else if(x>75 && x<=200){
    R = 100;
  }else if(x>200 && x<300){
    R = 150;
  }else if(x>300 && x<=400){
    R = 200;
  }else if(x>400){
    R = 255;
  }
   for(int i=0;i<NUMPIXELS;i++){
       pixels.setPixelColor(i, pixels.Color(R, G, B));}
   pixels.show();

}

void Sound_blinkingstar(int x){
  int divident;
      if(x<=10){
        divident = 15;
      }else if(x>10 && x<=75){
        divident = 10;
      }else if(x>75 && x<=200){
        divident = 5;
      }else if(x>200 && x<400){
        divident = 3;
      }else if(x>400 && x<=500){
        divident = 2;
      }else if(x>500){
        divident = 1;
      }
      for(int x=0;x<(NUMPIXELS/divident);x++){
        int i = rand() % NUMPIXELS;
        pixels.setPixelColor(i, pixels.Color(255, 255, 255));
      }
      pixels.show();
      findCode();
    pixels.clear();
  
}


//========================================================================= LED REMOTE MODES ======================================================================================

void kill(){
  buttonshift = 0;
   while(true){
      currentMillis = millis();
      if (currentMillis - previousMillis >= 100) 
      {
        previousMillis = currentMillis;
        for(int i=0;i<30;i++)
        {
          pixels.setPixelColor(i, pixels.Color(0, 0, 0));
        }
        pixels.show();
        findCode();
      }
      
   }

}


void greenmove() // change name
{ 
  buttonshift = 12;
  while(true){      
    int i = 0;
    while(i <= NUMPIXELS - 5)  //while(i <= 25)
    {
      currentMillis = millis();
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;        
        pixels.clear(); 
        if(i%2==0){ // shift pixel color as it moves
          pixels.setPixelColor(i, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i+1, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i+2, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i+3, pixels.Color(0, 255, 200));
          pixels.setPixelColor(i+4, pixels.Color(0, 255, 255));
        }else{
          pixels.setPixelColor(i, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i+1, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i+2, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i+3, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i+4, pixels.Color(255, 50, 0));
        }
        pixels.show();   // Send the updated pixel colors to the hardware.
        i++;
        findCode();
      }
    } 
        
   while(true) {
     currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis; 
          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(0, 255, 200));
          pixels.setPixelColor(NUMPIXELS-1, pixels.Color(0, 255, 255));
      pixels.show();
      break;
     }
   }
   while(true) {      
     currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis; 
          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(255, 50, 0));
          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(255, 50, 0));
          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(255, 50, 0));
          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(255, 50, 0));
          pixels.setPixelColor(NUMPIXELS-1, pixels.Color(255, 50, 0));
      pixels.show();
      break;
      }
    }
    
   while(true) {
     currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(0, 255, 150));
          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(0, 255, 200));
          pixels.setPixelColor(NUMPIXELS-1, pixels.Color(0, 255, 255));
      pixels.show();    
      break; 
     }
  }


while(i >= 4)
{ // For each pixel..
      currentMillis = millis();
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
      pixels.clear(); // Set all pixel colors to 'off'
     if(i%2==0){
          pixels.setPixelColor(i, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i-1, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i-2, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i-3, pixels.Color(0, 255, 150));
          pixels.setPixelColor(i-4, pixels.Color(0, 255, 150));
        }else{
          pixels.setPixelColor(i, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i-1, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i-2, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i-3, pixels.Color(255, 50, 0));
          pixels.setPixelColor(i-4, pixels.Color(255, 50, 0));
        }
      pixels.show();   // Send the updated pixel colors to the hardware.
      i--;
      findCode();
      }
 }

  while(true) {
    currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
          pixels.setPixelColor(4, pixels.Color(255, 50, 0));
          pixels.setPixelColor(3, pixels.Color(255, 50, 0));
          pixels.setPixelColor(2, pixels.Color(255, 50, 0));
          pixels.setPixelColor(1, pixels.Color(255, 50, 0));
          pixels.setPixelColor(0, pixels.Color(255, 50, 0));
      pixels.show();
      break;
     }
  }

  while(true) {      
      currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
          pixels.setPixelColor(4, pixels.Color(0, 255, 150));
          pixels.setPixelColor(3, pixels.Color(0, 255, 150));
          pixels.setPixelColor(2, pixels.Color(0, 255, 150));
          pixels.setPixelColor(1, pixels.Color(0, 255, 150));
          pixels.setPixelColor(0, pixels.Color(0, 255, 150));
      pixels.show();
      break;
    }
  }

  while(true) {     
      currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
          pixels.setPixelColor(4, pixels.Color(255, 50, 0));
          pixels.setPixelColor(3, pixels.Color(255, 50, 0));
          pixels.setPixelColor(2, pixels.Color(255, 50, 0));
          pixels.setPixelColor(1, pixels.Color(255, 50, 0));
          pixels.setPixelColor(0, pixels.Color(255, 50, 0));
      pixels.show();
      break;
     }
    }

 }
}



void redneonmove() 
{
  buttonshift = 10;
  while(true){
    
    int i = 0;
    while(i <= NUMPIXELS - 4)
    {
      currentMillis = millis();
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
        pixels.clear(); // Set all pixel colors to 'off'
        pixels.setPixelColor(i, pixels.Color(50, 10, 0));
        pixels.setPixelColor(i+1, pixels.Color(100, 25, 0));
        pixels.setPixelColor(i+2, pixels.Color(150, 25, 0));
        pixels.setPixelColor(i+3, pixels.Color(200, 25, 0));
        pixels.setPixelColor(i+4, pixels.Color(255, 25, 0));
        pixels.show();   // Send the updated pixel colors to the hardware.
        i++;
        findCode();
       }
    } 
                    
   previousMillis = 0;              
   while(true) {
    currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;                   
                          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(100, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(150, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(200, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(255, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-1, pixels.Color(200, 25, 0));
                          pixels.show();
                          break;
     }
   }
   while(true) {
    currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;                       
                          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(150, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(200, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(255, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(200, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-1, pixels.Color(150, 25, 0));
                          break;
     }
   }
     while(true) {
    currentMillis = millis();
     if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
                          pixels.setPixelColor(NUMPIXELS-5, pixels.Color(200, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-4, pixels.Color(255, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-3, pixels.Color(200, 25, 0));
                          pixels.setPixelColor(NUMPIXELS-2, pixels.Color(150, 25, 0));
...

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

Credits

Anas Mo

Anas Mo

1 project • 3 followers
Computer science student with big dreams :D

Comments