//fastled lib based RAINBOW-METER sound visualisation =^.^= MEOW (controling 120 WS2812 LEDs on PB8 with analog stereo audio input ) // read http://fastled.io/docs/3.1/group__chipsets.html if you not using WS2812 or WS2812B #define rot PB12 #define grun PB13 #define blau PB14 #define sound PA0 //analog input //fastled #include #define LED_PIN PB8 #define screeny 120 //number of leds #define BRIGHTNESS 255 #define LED_TYPE WS2812 #define COLOR_ORDER GRB CRGB leds[screeny]; CRGBPalette16 currentPalette; TBlendType currentBlending; extern CRGBPalette16 myRedWhiteBluePalette; extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM; //end void setup() { pinMode(rot, OUTPUT); pinMode(grun, OUTPUT); pinMode(blau, OUTPUT); delay( 1500 ); // power-up safety delay FastLED.addLeds(leds, screeny).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; //thanks for the cute rainbow currentBlending = BLEND; } void loop() { filtest(); FastLED.show(); FastLED.delay(1000 / 4000); } int zeit1=0; int zeit2=0; int zeit3=0; int zeit4=0; int color2=0; int color=0; int speedz=0; int32_t soundz =1000; int32_t soundz2 =1000; int32_t soundz3 =2000; int dif=2850; //groß=wenigerleds int dif2=2700; //groß=wenigerleds int dif3=480; //groß=tiefer int ka=0; int ka2=0; int dazuu=5; void filtest(void){ zeit1++; if (zeit1 > (((round(soundz2-dif2)/5)-round(soundz3-dif3)/5))) {color2 +=6; zeit1=0;}// movingng one color other leds calculating with this if (color2> 255) {color2=0;} color =color2; ka+=60; ka2+=20; if (ka > (screeny*10)){ka =0;} if (ka2 > (screeny*10)){ka2 =0;} if ((4000-analogRead(sound)) 1) {soundz-=random(20,23);} if ((4000-analogRead(sound)) >soundz ) {soundz+=random(20,23);} if ((4000-analogRead(sound)) soundz2) {soundz2+=5;} if ((analogRead(sound)) soundz3) {soundz3+=4;} for( int i = screeny; i > 0; i--) { color+=dazuu; //space between new colors leds[i] = CRGB::Black; if (i < (round(soundz-dif)/5)){leds[i] = ColorFromPalette( currentPalette,color, round(255-(i*3)+(i/1.3)), currentBlending);} //leds[screeny-i] = ColorFromPalette( currentPalette,color, BRIGHTNESS, currentBlending); if ( i == (round(ka/10)) ) { leds[i] = CRGB::White; } if ( i == (round(ka2/10)) ) { leds[i] = CRGB::White; } //if (i == (round(soundz2-dif2)/3.5) || i ==round((soundz2-dif)/6.5)) {leds[i]= 0x000000;} if (i == (round(soundz-dif2/5- random(0,1)))) {leds[i]= 0xffffff; } if (i == (round(soundz2-dif2)/5+18)) {leds[i]= 0x000000; } if (i == (round(soundz2-dif2)/6-4)) {leds[i]= 0x000000; } if (i == (round(soundz2-dif2)/4-5)) {leds[i]= 0x00ffff; } //bottom if (i == (round(soundz2-dif2)/5) || i==(round((soundz2-dif2)/5)+1)) {leds[i]= 0x0000ff; } if (i == (round(soundz2-dif2)/4.5)) {leds[i]= ColorFromPalette( currentPalette,round((soundz2-dif2)/5/2), BRIGHTNESS, currentBlending); } if (i == (round(soundz2-dif2)/5.5)) {leds[i]= ColorFromPalette( currentPalette,round((soundz2-dif2)/5/2), BRIGHTNESS, currentBlending); } if (i == (round(soundz2-dif2)/6+6)) {leds[i]= 0x00ffff; } if (i == (round(soundz3-dif3)/6.5-5)) {leds[i]= 0xffff00; } if (i == (round(soundz3-dif3)/7)) {leds[i]= 0xff00ff; } if (i == (round(soundz3-dif3)/7.5+4)) {leds[i]= 0xffff00; } } } //RAINBOW-METER STM32F103C8T6 128kb flash WS2812B code by marderchen =^.^= its ' FREE likeanything from me.. if you find something usefull //just use it or parts ~MORE RAINBOWPOWER /* MMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE OOOOOOOOO WWWWWWWW WWWWWWWW M:::::::M M:::::::ME::::::::::::::::::::E OO:::::::::OO W::::::W W::::::W M::::::::M M::::::::ME::::::::::::::::::::E OO:::::::::::::OO W::::::W W::::::W M:::::::::M M:::::::::MEE::::::EEEEEEEEE::::EO:::::::OOO:::::::OW::::::W W::::::W M::::::::::M M::::::::::M E:::::E EEEEEEO::::::O O::::::O W:::::W WWWWW W:::::W M:::::::::::M M:::::::::::M E:::::E O:::::O O:::::O W:::::W W:::::W W:::::W M:::::::M::::M M::::M:::::::M E::::::EEEEEEEEEE O:::::O O:::::O W:::::W W:::::::W W:::::W M::::::M M::::M M::::M M::::::M E:::::::::::::::E O:::::O O:::::O W:::::W W:::::::::W W:::::W M::::::M M::::M::::M M::::::M E:::::::::::::::E O:::::O O:::::O W:::::W W:::::W:::::W W:::::W M::::::M M:::::::M M::::::M E::::::EEEEEEEEEE O:::::O O:::::O W:::::W W:::::W W:::::W W:::::W M::::::M M:::::M M::::::M E:::::E O:::::O O:::::O W:::::W:::::W W:::::W:::::W M::::::M MMMMM M::::::M E:::::E EEEEEEO::::::O O::::::O W:::::::::W W:::::::::W M::::::M M::::::MEE::::::EEEEEEEE:::::EO:::::::OOO:::::::O W:::::::W W:::::::W M::::::M M::::::ME::::::::::::::::::::E OO:::::::::::::OO W:::::W W:::::W M::::::M M::::::ME::::::::::::::::::::E OO:::::::::OO W:::W W:::W MMMMMMMM MMMMMMMMEEEEEEEEEEEEEEEEEEEEEE OOOOOOOOO WWW WWW `..`... `...... `.. .. `........`....... `........`........ `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `...... `. `.. `...... `...... `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. `.. .. `.. `.. `..`........`........ */