//hihi a new 0603 RGB smd (4-pin) rainbowclock thistime much larger.. 7 0603 RGB/segment 6 segments,4x 6(0603RGB)as dots between numbers .. wouldnt realy know howmuch i have to conzentrade //for soldering 318 pcs from the smalest 4pin RGB leds ican find.. thisone: 0,33 ~1.10mm (hihi 4 contacts to solder in this surface...) https://www.digikey.com/catalog/en/partgroup/tri-color-rgb-rectangle-with-flat-top-0603-package-chip-leds/34398 have soldered them // and connectet to matrix networt for drifing with 8PNP and 18NPN transistors.. //pictures:: // http://www.marderchen.de/NEU+/large_0603_rainbowclock_1.jpg http://www.marderchen.de/NEU+/large_0603_rainbowclock_2.jpg // http://www.marderchen.de/NEU+/large_0603_rainbowclock_RGBleds_glued.jpg http://www.marderchen.de/NEU+/large_0603_rainbowclock_4_partsoldered.jpg // http://www.marderchen.de/NEU+/large_0603_rainbowclock_5_fortoday_pnpdone.jpg http://www.marderchen.de/NEU+/large_0603_rainbowclock_6_2numbersleft.jpg // http://www.marderchen.de/NEU+/large_0603_rainbowclock_7_all_954singleColorchips_connectetandtestetworkingyay.jpg http://www.marderchen.de/NEU+/large_0603_rainbowclock_chandegpnptransistors.jpg // http://www.marderchen.de/NEU+/large_0603_rainbowclock_8_yayfindsolution.jpg //Finaly its working as should (have to +5V connect the PNP base with the 5V and seperate PNP with diods.. so awesome! (but so much work .. cant ddo this often) // now just have to build case (caused somuch work thingt realy cute looking plossy black ABS plates and upgrade my rainbowmatrix segment code little //MEOW its free :3 have fun use it or parts is there is something usefull =^.^= //Have not much changed its also working on my virst 88x0603 rainbowclock #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 blau5 PA6 #define grun5 PA7 #define rot5 PB0 #define blau4 PB1 #define grun4 PB10 #define rot4 PB11 #define blau3 PB12 #define grun3 PB13 #define rot3 PB14 #define blau2 PB15 #define grun2 PA8 #define rot2 PA9 #define blau1 PA10 #define grun1 PB5 #define rot1 PB6 #define blau0 PB7 #define grun0 PB8 #define rot0 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;} refresh(); } 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); refresh(); } if (onpress[2] == 1) { onpress[3]++; } if (onpress[3] >= 5) { onpress[3] =0; onpress[2]=0; } blinkt++; onpress[4]=0; }}//tagrum 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,2);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 ==4) {digitise[zahliz][balkik][0]+=raincach2/balkik;} if (wasswie ==3) {digitise[zahliz][balkik][0]+=raincach2/zahliz/balkik;} if (wasswie ==2) {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[0][8][1] <196) {digitise[0][8][1]+=4;} if (digitise[1][8][1] <196) {digitise[1][8][1]+=4;} if (digitise[2][8][1] <196) {digitise[2][8][1]+=5;} if (digitise[3][8][1] <196) {digitise[3][8][1]+=5;} }} 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(); if (secs > 86400) {secs=0;}// the 4 dots between numbers digitise[0][8][1]=0; digitise[0][8][0]=random(0,60)*10; digitise[1][8][1]=0; digitise[1][8][0]=random(0,60)*10; digitise[2][8][1]=0; digitise[2][8][0]=random(0,60)*10; digitise[3][8][1]=0; digitise[3][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=0; fcount1 <200; fcount1++) { if (fcount1 == 0) {endoftime();} if (fcount1 <= 199) { 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 >= 200) {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(); }endoftime(); } 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!