// using my WS2812Bmiowmeter.. but want new code so here it is // 120x WS2812B stipe 60/m used vertical, Din =floor on STM32F103C8T6 PB8 (no other GPIOs used) (old board) power 5V (2Asupply +heatsink+capacitors) //aditional 10V 33uF capacitor soldered on stripe end 5V + ground for more efficience.. //programm for slowly running fading a ws2812b stripe in random color have fun use it if usefull :3 //finaly idea created ws2812B stripe tetrisanimation.. //random color pixel fall down... fall downpixel mix storring on ground.. //is similar pixal fall on same startflickering all pixels similar in mix also flickering and gone.. //mix fall together 2same colors together flickering again and all same colors gone.. continiues :3 //stripe full with bad chaos mix until 20leds left.. all flickering and gone.. //mix fall together 2 pixels near same again flickering.. nice game starting create a code //code and idea by marderchen :3 a realy complex logic stripegameanimation justuse this if like it hate capitalism! #include #define screenya 480 //enter number of leds you have in the stripe here rest is flexible (think 255maximum caused have used some uint8_t variables chane to uint16_t for using more leds #define screenyb 240 #define stripe 120 #define lines 5 /* a1/\ | a3/\ | b1/\ | a2\/ | a4\/ | b2\/ | stripeorder Din oben/unten */ //stripes a=480 >>PB8 stripes b=239 >>PB7 CRGBPalette16 currentPalette; CRGB ledsa[screenya+2]; CRGB ledsb[screenyb+2]; #define user PC13 //onboardled running indicator #define t1 PB12 #define t2 PB13 #define t3 PB14 #define t4 PB15 #define t5 PA8 #define Iled1 PB11 #define Iled2 PB10 #define Iled3 PB1 #define Iled4 PB0 #define Iled5 PA7 #define Iled6 PA6 void setup(){ pinMode(user,OUTPUT);pinMode(Iled1,OUTPUT);pinMode(Iled2,OUTPUT);pinMode(Iled3,OUTPUT);pinMode(Iled4,OUTPUT);pinMode(Iled5,OUTPUT);pinMode(Iled6,OUTPUT); pinMode(t1,INPUT);pinMode(t2,INPUT);pinMode(t3,INPUT);pinMode(t4,INPUT);pinMode(t5,INPUT); ledsaus(); FastLED.addLeds(ledsa, screenya); FastLED.addLeds(ledsb, screenyb); FastLED.setBrightness(255); currentPalette = RainbowColors_p; delay(100); //wait for full power } uint16_t merkd,positron,timer[11]; uint8_t timernewpix,rander,nexter[lines+1],hellmax=255,mengec,undmich=random(0,5);; uint8_t leddata[lines+1][stripe+2][2];//(color,brighteness) uint8_t gamedata[lines+1][stripe+2][10];//0active,1falingnoned,2timer,3intervall,4color,5position,6flicker,7hell,8flickertick void loop(){zeitreise();} long maintime=millis();long littletime=micros();long slowtime=millis(); void zeitreise(void){ while ((millis()- maintime) >= 2){maintime=millis();merkd++;if(merkd>20){merkd=0;}if(merkd<10){digitalWrite(user,LOW);}else{digitalWrite(user,HIGH);} timernewpix++; for(uint16_t z0mg=0; z0mg= 2){for(uint16_t reihe=0;reihe0){leddata[reihe][da][1]--;}if(leddata[reihe][da][1]>1){leddata[reihe][da][1]-=2;}}}slowtime = millis();} //fadedown while ((micros()- littletime) >= 9000){ for( uint16_t y = 0; y <=screenya; y++) { if(y =stripe && y <(2*stripe)){ledsa[240-y] = ColorFromPalette( currentPalette,leddata[3][y-stripe][0]*21,leddata[3][y-stripe][1],BLEND);} //a2 if(y >=(2*stripe) && y <(3*stripe)){ledsa[360-y] = ColorFromPalette( currentPalette,leddata[1][stripe-y-(2*stripe)][0]*21,leddata[1][stripe-y-(2*stripe)][1],BLEND);} //a3 if(y >=(3*stripe) && y <(4*stripe)){ledsa[480-y] = ColorFromPalette( currentPalette,leddata[4][y-(3*stripe)][0]*21,leddata[4][y-(3*stripe)][1],BLEND);}} //a3 for( uint16_t ys = 0; ys <=screenyb; ys++) { if(ys =stripe && ys <(2*stripe)){ledsb[(2*stripe)-ys] = ColorFromPalette( currentPalette,leddata[5][ys-stripe][0]*21,leddata[5][ys-stripe][1],BLEND);}} //b2 FastLED.show();littletime = micros();} //apply array if would notm much 2meter long datawire have to resort them^^ } void wuselfarben(void){ if(timernewpix>=rander){timernewpix=0; rander=random(20,30)*10; if(leddata[undmich][stripe-1][1]<10){gamedata[undmich][nexter[undmich]][0]=1;gamedata[undmich][nexter[undmich]][3]=random(1,6)*3;gamedata[undmich][nexter[undmich]][4]=random(0,12);gamedata[undmich][nexter[undmich]][5]=stripe; gamedata[undmich][nexter[undmich]][7]=hellmax;}}//setse startwert mengec=0; for(uint8_t linie=0;linie=gamedata[linie][gug][3]){gamedata[linie][gug][2]=0; //interfallticker if(gamedata[linie][gug][5]>0){if(leddata[linie][gamedata[linie][gug][5]-1][1]==0){gamedata[linie][gug][5]--;}}//fallrunter wen nächster schwarz } leddata[linie][gamedata[linie][gug][5]][0]=gamedata[linie][gug][4]; if(gamedata[linie][gug][7]>0){leddata[linie][gamedata[linie][gug][5]][1]=gamedata[linie][gug][7];}//überneme gamedata an position if(leddata[linie][gamedata[linie][gug][5]][0]==leddata[linie][gamedata[linie][gug][5]-1][0]){gamedata[linie][gug][6]=1;gamedata[linie][gug][3]=9;//erkenne doppelfarbe setz gleich flacker // for(uint8_t rechts=0;rechts20){for(uint8_t ww=0;ww<9;ww++){gamedata[linie][gug][ww]=0;}}//wegmach mengec++;// zähl aktive if(mengec >(stripe-20)){for(uint8_t rrR=0;rrR