//kote for driving the notestand 2x 8ter Ws2812 stick light //used 2x 8C2200mAh Li-po (incl protection board), 1x TP4056 chargingmodule with microUSBplud,5V2A st-up (extended efficience with capacitors) //used 1x STM32F103C8T6 minimum system board 72Mhz 128k Flash 20k RAM 32 GPIOs, 4 tactile push buttons (switching 3V3 to 470R groundet GPIO) //build in 1x On OFF switch 2x 10V 1000yF capacitors on 5V and 33yF 10V tanbtal capacitor in stepup Vin //buttons for adjusting color and brighteness kote by marderchen use it if usefull :3 #include #define screeny 17 //bit longer than stripe CRGB leds[screeny]; #define control PC13 #define t1 PB12 #define t2 PB13 #define t3 PB14 #define t4 PB15 void setup(){ delay(500); FastLED.addLeds(leds, screeny); FastLED.setBrightness(255); pinMode(t1, INPUT); pinMode(t2, INPUT); pinMode(t3 ,INPUT); pinMode(t4 ,INPUT);// pinMode(t5 ,INPUT); pinMode(control,OUTPUT); digitalWrite(control,LOW); } uint8_t onpress[12],bright=125;uint16_t farbig=150; void loop(){zeitreise();} long maintime=millis();long littletime=millis(); void zeitreise(void){ while ((millis()- maintime) >= 5){maintime=millis();onpress[10]++;istinput();} while ((millis()- littletime) >= 10){littletime = millis(); FastLED.setBrightness(bright); for( int y = 0; y < screeny; y++) { if(farbig <=100){leds[y].setRGB(farbig+155,0,0);}//0-rot if(farbig >100 && farbig <=200){leds[y].setRGB(255,(farbig-100)*2.54,0);}//rot->gelb if(farbig >200&& farbig <=300){leds[y].setRGB(255,255,(farbig-200)*2.54);}//gelb->weis if(farbig >300){leds[y].setRGB(255-((farbig-300)*2.54),255-((farbig-300)*2.54),255);}//weis->BLAU } FastLED.show();} digitalWrite(control,HIGH); } void istinput(void){ if (onpress[10] >2) { if (digitalRead(t2) == HIGH && onpress[0] ==0 && bright >=20) { onpress[0] =1; bright-=10;} if (onpress[0] == 1) { onpress[1]++;} if (onpress[1] >= 5) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t1) == HIGH && onpress[2] ==0 && bright <=245) { onpress[2] =1; bright+=10; } if (onpress[2] == 1) { onpress[3]++;} if (onpress[3] >= 5) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t4) == HIGH && onpress[4] ==0 && farbig >=5) { onpress[4] =1; farbig-=5; } if (onpress[4] == 1) { onpress[5]++;} if (onpress[5] >=5) { onpress[5] =0; onpress[4]=0; } if (digitalRead(t3) == HIGH && onpress[6] ==0 && farbig <=395) { onpress[6] =1; farbig+=5; } if (onpress[6] == 1) { onpress[7]++;} if (onpress[7] >=5) { onpress[7] =0; onpress[6]=0; } if((digitalRead(t1) || digitalRead(t2) || digitalRead(t3) || digitalRead(t4))==HIGH){digitalWrite(control,LOW);} onpress[10]=0; }}