// FULL RGB rainbow 6DIGs MSD highpreformance projectionclock for running rainmbows //hardwarepictures http://marderchen.de/NEU/HIGH-preformance_88x0603-RGB_rainbowclock_progress.jpg http://marderchen.de/NEU/HIGH-prefrmance_88x0603-RGB_rainbowclock_wiering.jpg http://marderchen.de/NEU/HIGH-prefrmance_88x0603-RGB_rainbowclock_protectionglossy.jpg waa somuch work //the wtf?! superbright SMD (lol so little3 cute purr the 0603 SMD RGB 4pin led size 1x0.8mm (including soldering vontacts, but extrem bright (looks like more then WS2812 with enough heatsink) on this little size its bright enough for adding lense befor and making projection <- this is how LED beamer should work! and not just build in 3 powerfull ledlightsources (one eache color and still shining through a extremly light stealing LCD by heating up^^) //used 88 pcs, 2 each dik balky, foledet with laquecooperwire to digmatrix, (its my self thinked matrix so not like standart) powwered by PNP and NPN transistors SWT ->200R->(only PNP have N4007 on input) (S8030 led and DB140 ->(only NPN:N4007on output for red color) ->LED) ->5V(+,-) **LED pin + to PNP (color negativ to pnp) >PNP over (5x N4007) to +5V positive oh better should draw it =^.^= //running.. maybe get more ideas for colorfun.. fading and brightenes sence to be working (not perfect but well) its running pretty fast.. eyes don't see flickering.. taster 1 chose dignumber (blinking) taster 2 count chosen number up .. //think there is much more brightenes possible its even not running warm.. maybe try voltage >5V for driving.. caused 5V is realy fast pulsed and not permanent glowing.. //MEOW =^.^= #define B1 PC13 #define B2 PC14 #define B3 PC15 #define B4 PA0 #define B5 PA2 #define B6 PA1 #define B7 PA3 #define B8 PA4 #define mess1 PA5 #define t1 PA15 #define t2 PA12 #define rot0 PA6 #define grun0 PA7 #define blau0 PB0 #define rot1 PB1 #define grun1 PB10 #define blau1 PB11 #define rot2 PB12 #define grun2 PB13 #define blau2 PB14 #define rot3 PB15 #define grun3 PA8 #define blau3 PA9 #define rot4 PA10 #define grun4 PB5 #define blau4 PB6 #define rot5 PB7 #define grun5 PB8 #define blau5 PB9 int16_t digitise[7][9][7]; //last: color, brighteness, (autocalculatet: redduty,greenduty,blueduty, whitadder, darkadder) int32_t secs =120; int8_t onpress[5]; int ani =200; int aus=0; int8_t zeitregen,blinkt,setzen; long maintime=millis(); long maintime2=micros(); long maintime3=millis(); String showme=""; void setup() { pinMode(rot0, OUTPUT); pinMode(grun0, OUTPUT); pinMode(blau0, OUTPUT); pinMode(rot1, OUTPUT); pinMode(grun1, OUTPUT); pinMode(blau1, OUTPUT); pinMode(rot2, OUTPUT); pinMode(grun2, OUTPUT); pinMode(blau2, OUTPUT); pinMode(rot3, OUTPUT); pinMode(grun3, OUTPUT); pinMode(blau3, OUTPUT); pinMode(rot4, OUTPUT); pinMode(grun4, OUTPUT); pinMode(blau4, OUTPUT); pinMode(rot5, OUTPUT); pinMode(grun5, OUTPUT); pinMode(blau5, OUTPUT); pinMode(B1, OUTPUT); pinMode(B2, OUTPUT); pinMode(B3, OUTPUT); pinMode(B4, OUTPUT); pinMode(B5, OUTPUT); pinMode(B6, OUTPUT); pinMode(B7, OUTPUT); pinMode(B8, OUTPUT); pinMode(t1, INPUT); pinMode(t2, INPUT); } void loop() { zeitreise(); anirainbow(); rainbowcalc(); machlicht(); drueckmich(); notime(); //zeigzeugs(0,'5'); //digitise[0][7][1]=200; } void drueckmich(void){ if (onpress[4] >=10) { if (digitalRead(t1) == HIGH && onpress[0] ==0 ) { setzen++; if (setzen >6) {setzen=0;}} if (onpress[0] == 1) { onpress[1]++; } if (onpress[1] >= 20) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0 ) { onpress[2] =1; setzden(setzen); } if (onpress[2] == 1) { onpress[3]++; } if (onpress[3] >= 5) { onpress[3] =0; onpress[2]=0; } blinkt++; onpress[4]=0; }} void setzden(int chosenone) { if (chosenone==0) {} if (chosenone==1) {secs+=1;} if (chosenone==2) {secs+=10;} if (chosenone==3) {secs+=60;} if (chosenone==4) {secs+=600;} if (chosenone==5) {secs+=3600;} if (chosenone==6) {} } void notime(void){ showme=""; if (((secs/60/60)%60) <=9){showme+="0";} showme+=String(((secs/60)/60)%60); if (((secs/60)%60) <=9){showme+="0";} showme+=String((secs/60)%60); if ((secs%60) <=9){showme+="0";} showme+=String(secs%60); // showme="1234 5"; if (blinkt >2) {showme[6-setzen]=' ';} if (blinkt >4) {blinkt=0;} } void refresh() { zeigzeugs(0,showme[5]); zeigzeugs(1,showme[4]); zeigzeugs(2,showme[3]); zeigzeugs(3,showme[2]); zeigzeugs(4,showme[1]); zeigzeugs(5,showme[0]); } int rainstart,raincach,raincach2,wasswie,wasswiewann; void anirainbow(void){ if (zeitregen > 1) { if (wasswiewann > 3) {wasswie=random(0,6);wasswiewann=0;} rainstart+=5; // if (rainstart >650) {rainstart=0;} raincach=rainstart; for( int zahliz = 0; zahliz < 6; zahliz ++) { raincach+=zahliz*10; raincach2=raincach; for( int balkik = 0; balkik <8; balkik ++) { raincach2+=balkik*3; if(raincach2 >670) {rainstart=0;} if (wasswie ==1) {digitise[zahliz][balkik][0]=raincach2;} if (wasswie ==2) {digitise[zahliz][balkik][0]+=raincach2/balkik;} if (wasswie ==3) {digitise[zahliz][balkik][0]+=raincach2/zahliz/balkik;} if (wasswie ==4) {digitise[zahliz][balkik][0]+=zahliz*2;} if (wasswie ==5) {digitise[zahliz][balkik][0]+=balkik*2;} if (wasswie ==6) {digitise[zahliz][balkik][0]+=(balkik+zahliz)/2;} if (digitise[zahliz][balkik][1] >70) {digitise[zahliz][balkik][1]-=5;}}} zeitregen=0; if (digitise[5][8][1] <196) {digitise[5][8][1]+=4;} }} void zeitreise(void){ while ((millis()- maintime) >= 5) { onpress[4]++; maintime = millis(); } while ((micros()- maintime2) >= 50) { zeitregen++; maintime2 = micros(); } while ((millis()- maintime3) >= 1000) { maintime3 = millis(); secs++; refresh(); digitise[5][8][1]=0; digitise[5][8][0]=random(0,60)*10; wasswiewann++; } } int duty[3]; int rainbow=0; void rainbowcalc(void) { for( int zahli = 0; zahli < 6; zahli ++) { for( int balki = 0; balki <=8; balki ++) { rainbow=digitise[zahli][balki][0]; // rainbow=100; if(rainbow >=0 && rainbow <=100) {duty[0] =100; duty[1] =rainbow; duty[2] =0;} //rot ->gelb (rotmax grün+ blau0) if(rainbow >=101 && rainbow <=201) {duty[0] =(100 -(rainbow -101)); duty[1] =100; duty[2] =0;} //gelb ->grün (rot- grünmax blau0) if(rainbow >=202 && rainbow <=302) {duty[0] =0; duty[1] =100; duty[2] =(rainbow - 202);} //grün ->cyan (rot0 grünmax blau+) if(rainbow >=303 && rainbow <=403) {duty[0] =0; duty[1] =(100 -(rainbow - 303)); duty[2] =100;} //cyan ->blau (rot0 grün- blaumax) if(rainbow >=404 && rainbow <=504) {duty[0] =(rainbow-404); duty[1] =0; duty[2] =100;} //blau ->lila (rot+ grün0 blaumax) if(rainbow >=505 && rainbow <=605) {duty[0] =100; duty[1] =0; duty[2] =(100- (rainbow -506));} //lila ->rot (rotmax grün0 blau-) if(rainbow >= 606) {rainbow =0; digitise[zahli][balki][0]=0;} digitise[zahli][balki][2]=duty[0]; digitise[zahli][balki][3]=duty[1]; digitise[zahli][balki][4]=duty[2]; }}} /*thingy showing balky in dig "PLAN" dots between are 8 in dig 6(if starting with1 and not 0) first dig from left.. * hihi i know there mus be a better solution better not count the if (s).. * if there is a other solution where i can duty for the 18 colorchanels simultan(sametime) required for fastenough for dutynumberfading.. just flickering if powering one by on * * ---1-- * | | * 3 2 []8 * | | * ---4--- * | | * 5 6 []8 * | | * ---7--- */ void zeigzeugs(int welchezahl,char wasden) { if (wasden == 'S') {wasden='5';} if (wasden == 'e') {wasden='9';} if (wasden == 'R') {wasden='A';} if (wasden == '0') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == '1') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == '2') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=ani;} if (wasden == '3') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == '4') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == '5') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == '6') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == '7') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == '8') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == '9') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == ' ') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=aus;} if (wasden == 'A') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == 'L') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=ani;} if (wasden == 't') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=ani;} if (wasden == 'i') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=aus; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == 'm') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == 'H') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=aus;} if (wasden == 'o') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=aus; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == 'U') {digitise[welchezahl][1][1]=aus; digitise[welchezahl][2][1]=ani; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=ani; digitise[welchezahl][7][1]=ani;} if (wasden == 'E') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=ani; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=ani;} if (wasden == 'C') {digitise[welchezahl][1][1]=ani; digitise[welchezahl][2][1]=aus; digitise[welchezahl][3][1]=ani; digitise[welchezahl][4][1]=aus; digitise[welchezahl][5][1]=ani; digitise[welchezahl][6][1]=aus; digitise[welchezahl][7][1]=ani;} //see how simple it is brain :3 } long startriger=micros(); int32_t light,darkness,dcach; //1//3//4 void machlicht(void) { for( int zahlie = 0; zahlie < 6; zahlie ++) { for( int balkie = 0; balkie <=8; balkie ++) { if (digitise[zahlie][balkie][1] > 100){digitise[zahlie][balkie][6]=digitise[zahlie][balkie][1]-100; digitise[zahlie][balkie][5]=0;}//white 200 white 100color working on brightenes but rainbow running if (digitise[zahlie][balkie][1] <=100){digitise[zahlie][balkie][5]=(100-(digitise[zahlie][balkie][1])); digitise[zahlie][balkie][6]=0;}//dark 100 color, 0less // ledata[dien][11]=(ledata[dien][12]*ledata[dien][12])/1.4; }} while ((micros()-startriger) >= 2) { for (int8_t balky=1; balky <=8; balky++) { if (balky ==1) {digitalWrite(B1, LOW );} if (balky ==2) {digitalWrite(B2, LOW );} if (balky ==3) {digitalWrite(B3, LOW );} if (balky ==4) {digitalWrite(B4, LOW );} if (balky ==5) {digitalWrite(B5, LOW );} if (balky ==6) {digitalWrite(B6, LOW );} if (balky ==7) {digitalWrite(B7, LOW );} if (balky ==8) {digitalWrite(B8, LOW );} // for (int16_t fcount1=0; fcount1 <(100+digitise[zahli][0][5] + digitise[zahli][0][6]); fcount1++) { for (int16_t fcount1=1; fcount1 <202; fcount1++) { if (fcount1 == ((101+digitise[0][balky][5] )-digitise[0][balky][2] )) { digitalWrite(rot0, HIGH );} if (fcount1 == ((101+digitise[0][balky][5] )-digitise[0][balky][3] )) { digitalWrite(grun0, HIGH );} if (fcount1 == ((101+digitise[0][balky][5] )-digitise[0][balky][4] )) { digitalWrite(blau0, HIGH );} if (fcount1 == ((101+digitise[1][balky][5] )-digitise[1][balky][2] )) { digitalWrite(rot1, HIGH );} if (fcount1 == ((101+digitise[1][balky][5] )-digitise[1][balky][3] )) { digitalWrite(grun1, HIGH );} if (fcount1 == ((101+digitise[1][balky][5] )-digitise[1][balky][4] )) { digitalWrite(blau1, HIGH );} if (fcount1 == ((101+digitise[2][balky][5] )-digitise[2][balky][2] )) { digitalWrite(rot2, HIGH );} if (fcount1 == ((101+digitise[2][balky][5] )-digitise[2][balky][3] )) { digitalWrite(grun2, HIGH );} if (fcount1 == ((101+digitise[2][balky][5] )-digitise[2][balky][4] )) { digitalWrite(blau2, HIGH );} if (fcount1 == ((101+digitise[3][balky][5] )-digitise[3][balky][2] )) { digitalWrite(rot3, HIGH );} if (fcount1 == ((101+digitise[3][balky][5] )-digitise[3][balky][3] )) { digitalWrite(grun3, HIGH );} if (fcount1 == ((101+digitise[3][balky][5] )-digitise[3][balky][4] )) { digitalWrite(blau3, HIGH );} if (fcount1 == ((101+digitise[4][balky][5] )-digitise[4][balky][2] )) { digitalWrite(rot4, HIGH );} if (fcount1 == ((101+digitise[4][balky][5] )-digitise[4][balky][3] )) { digitalWrite(grun4, HIGH );} if (fcount1 == ((101+digitise[4][balky][5] )-digitise[4][balky][4] )) { digitalWrite(blau4, HIGH );} if (fcount1 == ((101+digitise[5][balky][5] )-digitise[5][balky][2] )) { digitalWrite(rot5, HIGH );} if (fcount1 == ((101+digitise[5][balky][5] )-digitise[5][balky][3] )) { digitalWrite(grun5, HIGH );} if (fcount1 == ((101+digitise[5][balky][5] )-digitise[5][balky][4] )) { digitalWrite(blau5, HIGH );} if (fcount1 >= (100 + digitise[0][balky][6]) ) { digitalWrite(rot0, LOW ); digitalWrite(grun0, LOW ); digitalWrite(blau0, LOW );} if (fcount1 >= (100 + digitise[1][balky][6]) ) { digitalWrite(rot1, LOW ); digitalWrite(grun1, LOW ); digitalWrite(blau1, LOW );} if (fcount1 >= (100 + digitise[2][balky][6]) ) { digitalWrite(rot2, LOW ); digitalWrite(grun2, LOW ); digitalWrite(blau2, LOW );} if (fcount1 >= (100 + digitise[3][balky][6]) ) { digitalWrite(rot3, LOW ); digitalWrite(grun3, LOW ); digitalWrite(blau3, LOW );} if (fcount1 >= (100 + digitise[4][balky][6]) ) { digitalWrite(rot4, LOW ); digitalWrite(grun4, LOW ); digitalWrite(blau4, LOW );} if (fcount1 >= (101 + digitise[5][balky][6]) ) { digitalWrite(rot5, LOW ); digitalWrite(grun5, LOW ); digitalWrite(blau5, LOW );} if (fcount1 >= 201) {endoftime();} } digitalWrite(B1, HIGH ); digitalWrite(B2, HIGH ); digitalWrite(B3, HIGH ); digitalWrite(B4, HIGH ); digitalWrite(B5, HIGH ); digitalWrite(B6, HIGH ); digitalWrite(B7, HIGH ); digitalWrite(B8, HIGH ); } startriger = micros(); } } void endoftime(void) { digitalWrite(rot0, LOW ); digitalWrite(grun0, LOW ); digitalWrite(blau0, LOW ); digitalWrite(rot1, LOW ); digitalWrite(grun1, LOW ); digitalWrite(blau1, LOW ); digitalWrite(rot2, LOW ); digitalWrite(grun2, LOW ); digitalWrite(blau2, LOW ); digitalWrite(rot3, LOW ); digitalWrite(grun3, LOW ); digitalWrite(blau3, LOW ); digitalWrite(rot4, LOW ); digitalWrite(grun4, LOW ); digitalWrite(blau4, LOW ); digitalWrite(rot5, LOW ); digitalWrite(grun5, LOW ); digitalWrite(blau5, LOW ); } //*its marten code so always free use it or parts if there is something usefull for you.. //for clock projection oh its working.. but place between led far to long.. have no lense big enough (or 3 same lenses one for 2 digs) so put some light dissorb foil before (maybe mirrorfoil arround leds don't know // [MEOW] more rainbowpower!