Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. void vizualiser(){
  2.   bool newReading = MSGEQ7.read(EQ7interval); // Look for new reading
  3.  
  4.   if (newReading) {
  5.     FastLED.clear();
  6.     for(int s = 0; s < LEDstrips/2; s++){     // For each fq
  7.       uint8_t fq = MSGEQ7.get(s);             // Get reading  
  8.       fq = mapNoise(fq, nz, 255, 0, 255);     // Reduce noise
  9.       fq = map(fq, 0, 255, 0, LEDper);        // Scale values to length of strips
  10.      
  11.       for(int l = 0; l < fq; l++){            // Write values
  12.         leds[s][l].setHSV(hue+l*5, 255, 255);
  13.         leds[13-s][l].setHSV(hue+l*5, 255, 255);
  14.        
  15.         if(fq > EQ7max[s]) {                    // Rescale maximums
  16.         EQ7max[l] = fq;
  17.         } else {
  18.         EQ7reset[l]++;
  19.         if(EQ7reset[l] = 255){
  20.           EQ7max[s] = fq;
  21. //        EQ7reset++;        
  22.         }
  23.         }
  24.       }
  25.     }
  26.     FastLED.show();
  27.     hue++;
  28.   }
  29.   delay(30);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement