//12Digs (6blue+6red+2dotchannel) Time+Date clock used 8x A1SBH P-Channel mosfets direckt on STM32F103C8T6 GPIO and 12x NPN SMD transistor Y2 with 220R to GPIO //used 6tasters 1rd chosing dig to set 2rd and 3rd count up/down selected red DIG, 4rd and 5th count up/down selected blue DIG (selectet dig is fast flashing) //used 264 ultrabright half blue half red 3mm diffuse LEDs (realy much solderwork if connecting them with laquewires^^ // comming soon: alarm flash funktion select should be with 6th taster(switching 3V3 to 220Rgroundet GPIO) 2channel GPIO->220R->(D882 NPN)->one for 6 Green smd leds ->to 5V+one for 5(4running) 0.5W white leds //kote and project by marderchen =^.^= using date without date function is logical tricky but should work :3 have fun use it or parts if usefull =^.^= //think its finished now maybe change countdowntime to alarm time someday :3 /*pictures * https://marderchen.lima-city.de/NEU+/TIME+DATE_ledclockprogress.jpg * https://marderchen.lima-city.de/NEU+/large_time+date_ledclock_segmentssoldere.jpg * https://marderchen.lima-city.de/NEU+/SMD_info.jpg // think not need the high drain resistors(diodes^^) for red color.. tolate * https://marderchen.lima-city.de/NEU+/TIME+DATE_ledclock_wiering.jpg * https://marderchen.lima-city.de/NEU+/TIME+DATE_ledclock_front.jpg * https://marderchen.lima-city.de/NEU+/TIME+DATE_ledclock_koting.jpg * https://marderchen.lima-city.de/NEU+/TIME+DATE_ledclock_progress.jpg (awesome bright, LED matrix running with 5V2A stepup voltage * video upcomming funny just soltering everything anyway free from mint.. and writen Arduino C++ kote matching to solderwork.. and have cute working function =^.^= */ #define dig1 PB12 #define dig2 PB13 #define dig3 PB14 #define dig4 PB15 #define dig5 PA8 #define dig6 PA9 #define dig7 PA10 #define dig8 PB5 #define dig9 PB6 #define dig10 PB7 #define dig11 PB8 #define dig12 PB9 #define dig13 PC13 #define seg1 PB11 #define seg2 PB10 #define seg3 PB1 #define seg4 PB0 #define seg5 PA6 #define seg6 PA7 #define seg7 PA5 #define blau PC15 #define rot PC14 #define t1 PA12 #define t2 PA15 #define t3 PA4 #define t4 PA3 #define t5 PA2 #define t6 PA1 #define alwhite PA0 int16_t digitise[14][10]; //last: brighteness int32_t sect =20; int8_t onpress[14]; uint16_t fadefine=200; int ani =199; int aus=0; uint16_t redfade=10;uint16_t blaufade=10;uint16_t whitefade=0; uint16_t dotys; int8_t zeitregen,blinkt,setzen; long maintime=millis(); long maintime2=micros(); long maintime3=millis(); String showmeO=""; String showmeU=""; uint32_t runningSecs=3600; long runningDays=3; uint8_t monthlang[13] = {31,28,31,30,31,30,31,30,31,30,31}; uint8_t monthy=1; uint16_t jear=19; void setup() { pinMode(dig1, OUTPUT); pinMode(dig2, OUTPUT); pinMode(dig3, OUTPUT); pinMode(dig4, OUTPUT); pinMode(dig5, OUTPUT); pinMode(dig6, OUTPUT); pinMode(dig7, OUTPUT); pinMode(dig8, OUTPUT); pinMode(dig9, OUTPUT); pinMode(dig10, OUTPUT); pinMode(dig11, OUTPUT); pinMode(dig12, OUTPUT); pinMode(dig13, OUTPUT); pinMode(seg1, OUTPUT); pinMode(seg2, OUTPUT); pinMode(seg3, OUTPUT); pinMode(seg4, OUTPUT); pinMode(seg5, OUTPUT); pinMode(seg6, OUTPUT); pinMode(seg7, OUTPUT); pinMode(t1, INPUT); pinMode(t2, INPUT); pinMode(t3, INPUT); pinMode(t4, INPUT); pinMode(t5, INPUT); pinMode(t6, INPUT); pinMode(rot, OUTPUT); pinMode(blau, OUTPUT); pinMode(alwhite, OUTPUT); } boolean alon=false; boolean downcount=false;uint16_t alarmsec=0;uint8_t downmod=0; void loop() { zeitreise(); machlicht(); drueckmich(); if(downmod==0){notime(); nodate();} if(downmod>=1) {notime();noalarm();} } void drueckmich(void){ if (onpress[12] >=5) { if (digitalRead(t1) == HIGH && onpress[0] ==0 ) { onpress[0] =1; setzen++; if (setzen >6) {setzen=0;} } if (onpress[0] == 1) { onpress[1]++; } if (onpress[1] >= 5) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0 ) { onpress[2] =1; setzden(setzen,true); } if (onpress[2] == 1) { onpress[3]++; } if (onpress[3] >= 5) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t3) == HIGH && onpress[4] ==0 ) { onpress[4] =1; setzden(setzen,false);} if (onpress[4] == 1) { onpress[5]++; } if (onpress[5] >= 5) { onpress[5] =0; onpress[4]=0; } if (digitalRead(t4) == HIGH && onpress[6] ==0 ) { onpress[6] =1; if(downmod==0){setzdatum(setzen,true);} if(downmod==1){setzalarm(setzen,true);}} if (onpress[6] == 1) { onpress[7]++; } if (onpress[7] >= 5) { onpress[7] =0; onpress[6]=0; } if (digitalRead(t5) == HIGH && onpress[8] ==0 ) { onpress[8] =1; if(downmod==0){setzdatum(setzen,false);}if(downmod==1){setzalarm(setzen,false);}} if (onpress[8] == 1) { onpress[9]++; } if (onpress[9] >= 5) { onpress[9] =0; onpress[8]=0; } if (digitalRead(t6) == HIGH && onpress[10] ==0 ) { onpress[10] =1; downmod++; if (downmod>=3){downmod=0;}} if (onpress[10] == 1) { onpress[11]++; } if (onpress[11] >= 10) { onpress[11] =0; onpress[10]=0; } if ((digitalRead(t1) ||digitalRead(t2) ||digitalRead(t3) ||digitalRead(t4) ||digitalRead(t5) ||digitalRead(t6))==HIGH){redfade=fadefine;} onpress[12]=0; }}//tagrum void setzden(int chosenone,boolean updown) { if(updown==true){ if (chosenone==1) {runningSecs+=1;} if (chosenone==2) {runningSecs+=10;} if (chosenone==3) {runningSecs+=60;} if (chosenone==4) {runningSecs+=600;} if (chosenone==5) {runningSecs+=3600;} if (chosenone==6) {runningSecs+=36000;} } else{ if (chosenone==1 && runningSecs >= 1) {runningSecs-=1;} if (chosenone==2 && runningSecs >= 10) {runningSecs-=10;} if (chosenone==3 && runningSecs >= 60) {runningSecs-=60;} if (chosenone==4 && runningSecs >= 600) {runningSecs-=600;} if (chosenone==5 && runningSecs >= 3600) {runningSecs-=3600;} if (chosenone==6 && runningSecs >= 36000) {runningSecs-=36000;} } } void setzdatum(int dasda,boolean raufrunter){ if(raufrunter==true){ if (dasda==2 && runningDays=1){runningDays--;} if (dasda==1 && runningDays>=10){runningDays-=10;} if (dasda==4 && monthy>=1){monthy--;} if (dasda==3 && monthy>=10){monthy-=10;} if (dasda==6 && jear>=1){jear--;} if (dasda==5 && jear>=10){jear-=10;} }} void setzalarm(int chosenone2,boolean updown2) { if(updown2==true){ if (chosenone2==1) {alarmsec+=1;} if (chosenone2==2) {alarmsec+=10;} if (chosenone2==3) {alarmsec+=60;} if (chosenone2==4) {alarmsec+=600;} if (chosenone2==5) {alarmsec+=3600;} if (chosenone2==6) {alarmsec+=36000;} } else{ if (chosenone2==1 && alarmsec >= 1) {alarmsec-=1;} if (chosenone2==2 && alarmsec >= 10) {alarmsec-=10;} if (chosenone2==3 && alarmsec >= 60) {alarmsec-=60;} if (chosenone2==4 && alarmsec >= 600) {alarmsec-=600;} if (chosenone2==5 && alarmsec >= 3600) {alarmsec-=3600;} if (chosenone2==6 && alarmsec >= 36000) {alarmsec-=36000;} } } void notime(void){ showmeO=""; if ((((runningSecs/60)/60)%60) <=9){ showmeO+="0";} showmeO +=((runningSecs/60)/60)%60; if (((runningSecs/60)%60) <=9){ showmeO+="0";} showmeO +=(runningSecs/60)%60; if ((runningSecs%60) <=9){ showmeO+="0";} showmeO +=runningSecs%60; if (blinkt >2) {showmeO[6-setzen]=' '; }//? if (blinkt >4) {blinkt=0;} } void nodate(void) { showmeU=""; if((runningDays%monthlang[monthy])<=9){showmeU +="0";} showmeU +=runningDays%monthlang[monthy]; if((monthy%12) <=9) {showmeU +="0";} showmeU +=monthy%12; if((jear%99)<=9) {showmeU +="0";} showmeU +=jear%99; if (blinkt <=2) {showmeU[setzen-1]=' ';} } void noalarm(void){ showmeU=""; if ((((alarmsec/60)/60)%60) <=9){ showmeU+="0";} showmeU +=((alarmsec/60)/60)%60; if (((alarmsec/60)%60) <=9){ showmeU+="0";} showmeU +=(alarmsec/60)%60; if ((alarmsec%60) <=9){ showmeU+="0";} showmeU +=alarmsec%60; if (blinkt >2) {showmeU[6-setzen]=' '; } } void refresh() { zeigzeugs(1,showmeO[0]); zeigzeugs(3,showmeO[1]); zeigzeugs(5,showmeO[2]); zeigzeugs(7,showmeO[3]); zeigzeugs(9,showmeO[4]); zeigzeugs(11,showmeO[5]); zeigzeugs(0,showmeU[0]); zeigzeugs(2,showmeU[1]); zeigzeugs(4,showmeU[2]); zeigzeugs(6,showmeU[3]); zeigzeugs(8,showmeU[4]); zeigzeugs(10,showmeU[5]); } void zeigdots(){ dotys++; if(dotys<=2) {digitise[12][1]=fadefine;} if(dotys==20) {digitise[12][1]=fadefine;} if(dotys<=20) {digitise[12][2]=fadefine-5;} if(dotys==40) {digitise[12][2]=fadefine;} if(downmod >=3){ if(dotys==1) {whitefade=fadefine;} if(dotys==10) {blaufade=fadefine;} if(dotys==20) {whitefade=fadefine;} if(dotys==30) {blaufade=fadefine;} } } void zeitreise(void){ while ((millis()- maintime) >= 15) { onpress[12]++; if (setzen !=0) {refresh();} if(redfade >4) {redfade-=4;} downfade();blinkt++;zeigdots(); maintime = millis(); } while ((micros()- maintime2) >= 50) { maintime2 = micros(); } while ((millis()- maintime3) >= 999) { maintime3 = millis(); runningSecs++; if(runningSecs>86400){runningSecs=0; runningDays++; if(runningDays >monthlang[monthy]){runningDays=1;monthy++; if(monthy>12){monthy=1;jear++;}}}// strange datesolutin if (downmod==1) {redfade=fadefine;} if (downmod==2 && alarmsec>=1) {alarmsec--;} if (downmod==2 && alarmsec<=1) {downmod=3;} refresh(); dotys=0; }} uint8_t steptz=2; void downfade(void) { for (int16_t digs=0; digs <=8; digs++) { for (int16_t ad=0; ad <=7; ad++) { if(digitise[digs][ad]>steptz) { digitise[digs][ad]-=steptz;} }} if(redfade>=3){redfade-=3;} if(blaufade>=4){blaufade-=4;} whitefade=blaufade;//for test if(digitise[12][1]>=4) {digitise[12][1]-=4;} if(digitise[12][2]>=4) {digitise[12][2]-=4;} } /*thingy showing 0 in dig "PLAN" dots between are 8 in dig 6(if starting with1 and not 0) first dig from left.. * hihi i know there must be a better solution better but better using my one caused its working fine :3 * * ---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]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == '1') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == '2') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=ani;} if (wasden == '3') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == '4') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == '5') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == '6') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == '7') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == '8') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == '9') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == ' ') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=aus;} if (wasden == 'A') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == 'L') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=ani;} if (wasden == 't') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=ani;} if (wasden == 'i') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=aus; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == 'm') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == 'H') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=aus;} if (wasden == 'o') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=aus; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == 'U') {digitise[welchezahl][1]=aus; digitise[welchezahl][2]=ani; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=ani; digitise[welchezahl][7]=ani;} if (wasden == 'E') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=ani; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=ani;} if (wasden == 'C') {digitise[welchezahl][1]=ani; digitise[welchezahl][2]=aus; digitise[welchezahl][3]=ani; digitise[welchezahl][4]=aus; digitise[welchezahl][5]=ani; digitise[welchezahl][6]=aus; digitise[welchezahl][7]=ani;} //see how simple it is brain :3 } long startriger=micros(); void machlicht(void) { while ((micros()-startriger) >= 2) { //for (uint8_t often=0; often <100; often++) { for (int16_t sekt=1; sekt <=7; sekt++) { noseg(); if(sekt ==1) {digitalWrite(seg1, LOW );} if(sekt ==2) {digitalWrite(seg2, LOW );} if(sekt ==3) {digitalWrite(seg3, LOW );} if(sekt ==4) {digitalWrite(seg4, LOW );} if(sekt ==5) {digitalWrite(seg5, LOW );} if(sekt ==6) {digitalWrite(seg6, LOW );} if(sekt ==7) {digitalWrite(seg7, LOW );} for (int16_t fcount1=0; fcount1 <(fadefine+2); fcount1++) { if (fcount1 == 0) {nodig();} if (fcount1 < fadefine && fcount1>=1) { if (fcount1 == ((fadefine)-digitise[0][sekt])) { digitalWrite(dig1, LOW );} if (fcount1 == ((fadefine)-digitise[1][sekt])) { digitalWrite(dig2, LOW );} if (fcount1 == ((fadefine)-digitise[2][sekt])) { digitalWrite(dig3, LOW );} if (fcount1 == ((fadefine)-digitise[3][sekt])) { digitalWrite(dig4, LOW );} if (fcount1 == ((fadefine)-digitise[4][sekt])) { digitalWrite(dig5, LOW );} if (fcount1 == ((fadefine)-digitise[5][sekt])) { digitalWrite(dig6, LOW );} if (fcount1 == ((fadefine)-digitise[6][sekt])) { digitalWrite(dig7, LOW );} if (fcount1 == ((fadefine)-digitise[7][sekt])) { digitalWrite(dig8, LOW );} if (fcount1 == ((fadefine)-digitise[8][sekt])) { digitalWrite(dig9, LOW );} if (fcount1 == ((fadefine)-digitise[9][sekt])) { digitalWrite(dig10, LOW );} if (fcount1 == ((fadefine)-digitise[10][sekt])) { digitalWrite(dig11, LOW );} if (fcount1 == ((fadefine)-digitise[11][sekt])) { digitalWrite(dig12, LOW );} if (fcount1 == ((fadefine)-digitise[12][sekt])) { digitalWrite(dig13, LOW );} if (fcount1 == ((fadefine)-whitefade)) { digitalWrite(alwhite, HIGH );} if (fcount1 == ((fadefine)-blaufade)) { digitalWrite(blau, HIGH );} if (fcount1 == ((fadefine)-redfade)) { digitalWrite(rot, LOW );}} if (fcount1 > (fadefine)) {nodig(); noseg();nomeld();} }} startriger = micros(); } } void nodig(void) { digitalWrite(dig1, HIGH ); digitalWrite(dig2, HIGH ); digitalWrite(dig3, HIGH ); digitalWrite(dig4, HIGH ); digitalWrite(dig5, HIGH ); digitalWrite(dig6,HIGH ); digitalWrite(dig7, HIGH ); digitalWrite(dig8, HIGH ); digitalWrite(dig9, HIGH ); digitalWrite(dig10,HIGH ); digitalWrite(dig11,HIGH ); digitalWrite(dig12, HIGH ); digitalWrite(dig13, HIGH );} void noseg(void) { digitalWrite(seg1, HIGH ); digitalWrite(seg2, HIGH ); digitalWrite(seg3, HIGH ); digitalWrite(seg4, HIGH ); digitalWrite(seg5, HIGH ); digitalWrite(seg6, HIGH ); digitalWrite(seg7, HIGH ); } void nomeld(void){digitalWrite(rot, HIGH);digitalWrite(blau, LOW );digitalWrite(alwhite, LOW );} //[MEOW] project by marderchen us3e it or parts if usefull :3