//MEOW IR controlled 2x 3Wblue 1x 3W RGB 5x 0603 RGB 5x Taster 1x 8x7segment maxdig module Nightlight //microcontroller: STM32F103C8T6 128Kb FLASH 20KB RAM 32GPIO minimum systemboard //cells 3x 3.6V Li-ion (7200mAh total) with protectionboard //input 5V up to 2AmicroUSB (permanentpower and charge) Output 5V 2A USb female //lots of SMD capacitiors, DIODES, Resistors //remote 1taster (lithium 3V cell inside should work years) if not replace Lithium cell or use any taster on anjy IR remote #define rot PC13 //GPIO -> 220R->BD237 2A NPN transistor->2x 2A100V diodenlastwiederstand-> 3Watt RGB LED (ROT) ->+5V #define grun PC14 //GPIO -> 220R->BD237 2A NPN transistor->2A100V diodenlastwiederstand-> 3Watt RGB LED (Gruen) ->+5V #define blau PC15 //GPIO -> 220R->BD237 2A NPN transistor->2A100V diodenlastwiederstand-> 3Watt RGB LED (BLAU) ->+5V #define blau1 PA0 //GPIO -> 220R->BD237 2A NPN transistor->2A100V diodenlastwiederstand-> 3Watt Blau LED ->+5V #define blau2 PA1 //GPIO -> 220R->BD237 2A NPN transistor->2A100V diodenlastwiederstand-> 3Watt Blau LED ->+5V #define poti PA2 //analog potentiometer *3V3-GPIO-GNG #define batt PB0 //optokoppler für batteriespannung #define IRRE PA3 //Infrarot receiver *on +5V,GND,Output #define t4 PB12 //3V3->SMD fronttaster ->GPIO ->221R SMD to ground #define t5 PB13 //3V3->SMD fronttaster ->GPIO ->221R SMD to ground #define t3 PB14 //3V3->SMD fronttaster ->GPIO ->221R SMD to ground #define t2 PA12 //3V3->SMD fronttaster ->GPIO ->221R SMD to ground #define t1 PA15 //3V3->SMD fronttaster ->GPIO ->221R SMD to ground #define rotf1 PB9 //1. 0603 RGB led front 3V3->LED (rot)->microSMD diodenwiderstand->GPIO(ground switched) #define blauf1 PB8 //1. 0603 RGB led front 3V3->LED(blau)->mGPIO(ground switched) #define rotf2 PB7 //2. 0603 RGB led front 3V3->LED (rot)->microSMD diodenwiderstand->GPIO(ground switched) #define blauf2 PB6 //2. 0603 RGB led front 3V3->LED(blau)->GPIO(ground switched) #define rotf3 PB5 //3. 0603 RGB led front 3V3->LED (rot)->microSMD diodenwiderstand->GPIO(ground switched) #define blauf3 PA10 //3. 0603 RGB led front 3V3->LED(blau)->GPIO(ground switched) #define rotf4 PA9 //4. 0603 RGB led front 3V3->LED (rot)->microSMD diodenwiderstand->GPIO(ground switched) #define blauf4 PA8 //4. 0603 RGB led front 3V3->LED(blau)->GPIO(ground switched) #define rotf5 PB15 //5. 0603 RGB led front 3V3->LED (rot)->microSMD diodenwiderstand->GPIO(ground switched) #define blauf5 PB1 //5. 0603 RGB led front 3V3->LED(blau)->GPIO(ground switched) #include #include #include const byte chips = 1; MAX7219 display (chips, PA4, PA7, PA5); // Chips / LOAD / DIN / CLK uint8_t onpress[15]; uint8_t bediendas,limithier,daszeugs,blinkt,autofaden,setzden,helldunkel; uint8_t moduswechsel=0; uint16_t duty[5],dutyf[10]; uint16_t zellenpower,blauhelligkeit,bright,light,darkness,zeit1,zeit2,hellmerker,kurzinfo,nochmehrmerk,blitziblitz; uint16_t rainbow=1200; //start RGB farbe blau uint16_t dasist=1020; //ir startwert uint16_t wenndasist=250; //ir schaltwert uint16_t RGBhelligkeit=400; //0=aus,800=weis uint16_t sollsohell=200; uint16_t offtime=600; // voreingestellte countdownzeit uint16_t timeleft=20; //zeitzähler uint16_t maxhell=200; uint16_t minhell=20; long maintime=millis(); long maintime2=millis(); long maintime3=micros(); long startriger=micros(); long timez= millis(); long setalarm=3600; long runntime=0; boolean onk=false; boolean nenset=false; boolean tplusset=false; boolean tminusset=false; boolean countdown=false; String outzi=""; void setup() { delay(200); pinMode(rot, OUTPUT); pinMode(grun, OUTPUT); pinMode(blau, OUTPUT); pinMode(blau1, OUTPUT); pinMode(blau2, OUTPUT); pinMode(rotf1, OUTPUT); pinMode(blauf1, OUTPUT); pinMode(rotf2, OUTPUT); pinMode(blauf2, OUTPUT); pinMode(rotf3, OUTPUT); pinMode(blauf3, OUTPUT); pinMode(rotf4, OUTPUT); pinMode(blauf4, OUTPUT); pinMode(rotf5, OUTPUT); pinMode(blauf5, OUTPUT); pinMode(t1, INPUT); pinMode(t2, INPUT); pinMode(t3 ,INPUT); pinMode(t4 ,INPUT); pinMode(t5 ,INPUT); delay(300); digitalWrite(rotf1, LOW); digitalWrite(rotf2, LOW); digitalWrite(rotf3, LOW); digitalWrite(rotf4, LOW); digitalWrite(rotf5, LOW); display.begin (); delay(100); undlos("boot",0); delay(300); digitalWrite(blauf1,LOW); digitalWrite(blauf2,LOW); digitalWrite(blauf3,LOW); digitalWrite(blauf4,LOW); digitalWrite(blauf5,LOW); } void loop() { istinput(); zeitreise(); machlicht(); } void funktionsmodis(uint8_t denda) { if (denda==0) {limithier=3; //nachlicht if (dasist < wenndasist ) {schaltmal(false); dasist=800; timeleft=offtime;daszeugs=1;} if (nenset==true) {timeleft=offtime; nenset=false;daszeugs=1;} if(onk==false && timeleft >0) {hellmerker=blauhelligkeit; } //poti= hellgikeit if(onk==true && timeleft >0 && hellmerker 0 && hellmerker >sollsohell) {hellmerker--;daszeugs=1;} if(onk==true && timeleft ==0 && hellmerker >blauhelligkeit) {hellmerker--;daszeugs=0;} if (bediendas == 0 && onk==false) {daszeugs=0; //änder countsdownlänge if (tplusset ==true) {tplusset=false; offtime+=120; if ( offtime >1800) { offtime=1800;}} if (tminusset ==true) {tminusset=false; offtime-=60; if ( offtime <0) { offtime=0;}}} if (bediendas == 1 && onk==false) {daszeugs=8; //änder countsdownlänge if (tplusset ==true) {tplusset=false; sollsohell+=50; if ( sollsohell >800) { sollsohell=800;}} if (tminusset ==true) {tminusset=false; sollsohell-=60; if ( sollsohell <0) { sollsohell=0;}}} if (bediendas == 2 && onk==false) {daszeugs=2; //änder RGB farbe if (tplusset ==true) {tplusset=false; rainbow+=120; if ( rainbow >2400) { rainbow=2400;}} if (tminusset ==true) {tminusset=false; rainbow-=60; if ( rainbow <0) { rainbow=0;}}} duty[3]=hellmerker; duty[4]=hellmerker; bright=hellmerker/2; //RGB =aqus bis purfarbe } if (denda==1) {limithier=2; //lampe an aus if (dasist < wenndasist) {schaltmal(true); dasist=800;} if(onk==false) {hellmerker=0;} //aus =aus if(onk==true) {hellmerker=blauhelligkeit;} //an =einstellhelligkeit if(onk==true && hellmerker blauhelligkeit){hellmerker--;} if (tplusset ==true) {tplusset=false; rainbow+=120; if ( rainbow >2400) { rainbow=2400;}} //änderRGBfarbe if (tminusset ==true) {tminusset=false; rainbow-=60; if ( rainbow <0) { rainbow=0;}} if (onk==true) {daszeugs=3;} //zeig batteriepower wenn an if (bediendas == 0 && onk==false) {daszeugs=4;} //zeig einschalthelligkeit if (bediendas == 1 && onk==false) {daszeugs=2;} //zeig regenbogenfarbe duty[3]=hellmerker; duty[4]=hellmerker; bright=hellmerker; //RGB=aus bis weiß } if (denda==2) {limithier=2; //fade hell<->dunkel oder regenbogen if (dasist < wenndasist) {schaltmal(true); dasist=800;} if(onk==false) {autofaden=0;} //aus =aus if(onk==true) { if (bediendas==0) {autofaden=1; daszeugs=5;} //dimt automatisch hell dunkel poti =speed if (bediendas==1) {autofaden=2;}} //spult regenbogen if (tplusset ==true) {tplusset=false; maxhell+=20; if ( maxhell >800) { maxhell=minhell;}} //maximalhelligkeitwechelpunkt if (tminusset ==true) {tminusset=false; minhell-=10; if ( minhell <=0) { minhell=maxhell;}} //ändertminimalhelligkeitwechselpunkt duty[3]=hellmerker; duty[4]=hellmerker; bright=hellmerker/2; //RGB=aus bis weiß }else {autofaden=0;} if (denda==3) {limithier=6; // blitzlichttimer if (dasist < wenndasist) {schaltmal(true); dasist=800;} if(onk==false) {daszeugs=6; countdown=false; setzden=bediendas; //zeit ändern wenn aus if (tplusset ==true) {tplusset=false; setzen(setzden,true);} //blinkende zahl ändern if (tminusset ==true) {tminusset=false; setzen(setzden,false);} } if(onk==true) {daszeugs=7; countdown=true;} if(countdown==true && ((blitziblitz%(round(blitziblitz/8)))==0)) { if ((blitziblitz %2)==0){duty[3]=(100-blitziblitz*5); duty[4]=(100-blitziblitz*5);} if ((blitziblitz %2)==1){bright=(100-blitziblitz*8); } }else {duty[3]=0; duty[4]=0; bright=0;} } } void SPAM(){ if (daszeugs==0) {zeigwort("off ",1); zeigzahl(offtime,2); } if (daszeugs==1) {zeigwort("noch",1); zeigzahl(timeleft,2);} if (daszeugs==2) {zeigwort("colo",1); zeigzahl(rainbow,2);} if (daszeugs==3) {zeigwort("Batt",1); zeigzahl(zellenpower*2,2);} if (daszeugs==4) {zeigwort("hell",1); zeigzahl(blauhelligkeit,2);} if (daszeugs==5) {zeigzahl(minhell,1); zeigzahl(maxhell,2);} if (daszeugs==6) {keinezeit(setalarm,setzden);} if (daszeugs==7) {keinezeit(setalarm,0);} if (daszeugs==8) {zeigwort("soll ",1); zeigzahl(sollsohell,2); } } void setzen(uint8_t chosenone,boolean plusminus) { if (chosenone==0) {} if (plusminus==true){ if (chosenone==1) {setalarm+=1;} if (chosenone==2) {setalarm+=10;} if (chosenone==3) {setalarm+=60;} if (chosenone==4) {setalarm+=600;} if (chosenone==5) {setalarm+=3600;} if (chosenone==6) {setalarm+=36000;}} if (plusminus==false){ if (chosenone==1) {setalarm-=1;} if (chosenone==2) {setalarm-=10;} if (chosenone==3) {setalarm-=60;} if (chosenone==4) {setalarm-=600;} if (chosenone==5) {setalarm-=3600;} if (chosenone==6) {setalarm-=36000;}} if (setalarm > 356400) {setalarm=356400;} if (setalarm <0) {setalarm=0;} } long cachz=0; void lesesensibel(){ if ((analogRead(IRRE)/4) > dasist) {dasist+=1; } //1023 of - 250on *1...750 if ((analogRead(IRRE)/4) < dasist) {dasist-=1; } if ((analogRead(poti)/5) > blauhelligkeit) {blauhelligkeit+=2;} if ((analogRead(poti)/5) < blauhelligkeit) {blauhelligkeit-=2;} if ((analogRead(batt)/2) > zellenpower) {zellenpower+=1;} if ((analogRead(batt)/2) < zellenpower) {zellenpower-=1;} //if((1030-(dasist*21))>1){cachz=(;} fadefront((1030-dasist)*21); } /* void calcucatefront(uint32_t wert,boolean hochrunter){ // if (wert>5 && (nochmehrmerk != wert)) { //maybe (+ && ((nochmehrmerk+1) != wert) && ((nochmehrmerk-1) != wert)) //if (hochrunter==true){fadefront(10*wert);} // if (hochrunter==false){fadefront(16000-10*wert);} // nochmehrmerk=wert;} fadefront(wert); }*/ void schaltmal(boolean anaus){ if (anaus==true) { if (onk==true) {onk=false; return;}else {onk=true; return;}} if (anaus==false){onk=true;} } uint8_t kinfo=0; void istinput(void){ if (zeit1 >=5) { if (digitalRead(t1) == HIGH && onpress[0] ==0) { onpress[0] =1; moduswechsel++; if (moduswechsel >=4) {moduswechsel=0;} kinfo=0;kurzinfo=20;} if (onpress[0] == 1) { onpress[1]++; } if (onpress[1] >= 15) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0) { onpress[2] =1; bediendas++; if (bediendas>limithier) {bediendas=0;}kinfo=1;kurzinfo=20;} if (onpress[2] == 1) { onpress[3]++;} if (onpress[3] >= 10) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t3) == HIGH && onpress[4] ==0) { onpress[4] =1; schaltmal(true); nenset=true;} if (onpress[4] == 1) { onpress[5]++;} if (onpress[5] >= 20) { onpress[5] =0; onpress[4]=0; } if (digitalRead(t4) == HIGH && onpress[6] ==0) { onpress[6] =1; tplusset=true; } if (onpress[6] == 1) { onpress[7]++; } if (onpress[7] >= 6) { onpress[7] =0; onpress[6]=0; } if (digitalRead(t5) == HIGH && onpress[8] ==0) { onpress[8] =1; tminusset=true; } if (onpress[8] == 1) { onpress[9]++;} if (onpress[9] >= 6) { onpress[9] =0; onpress[8]=0; } if (kurzinfo >0 && kinfo==0) {kurzinfo--; blinkt++; if (blinkt >4) {blinkt=0;} undlos("nnodus_",moduswechsel);} if (kurzinfo==0) {SPAM();} zeit1=0; }} void zeitreise(void){ while ((millis()- maintime) >= 10) { if(moduswechsel ==3) {if(setalarm ==0) {blitziblitz++; if (blitziblitz >100) {blitziblitz=0;}}} zeit1++; maintime = millis(); } while ((micros()- maintime3) >= 60) { lesesensibel(); maintime3 = micros();} while ((millis()- maintime2) >= 6) { funktionsmodis(moduswechsel); if(moduswechsel ==2) { if (autofaden==0) {hellmerker=0;} if (autofaden==1) {zeit2++; if (zeit2 >(blauhelligkeit/5)) {zeit2=0; if(helldunkel==0) {hellmerker++;} if(helldunkel==1) {hellmerker--;} if(hellmerker >maxhell) {helldunkel=1;} if(helldunkel <=minhell){helldunkel=0;}}} if (autofaden==2) {zeit2++; if (zeit2 >(blauhelligkeit/10)) {zeit2=0; rainbow++;}}} maintime2 = millis(); } while ((millis()- timez) >= 998) { if(moduswechsel==3) {if (countdown ==true) {if (setalarm >0) {setalarm--;}}} if (timeleft>0){timeleft--;}SPAM(); timez = millis(); } } void zeigwortuzahl(String texte, int werty){ zeigwort(texte,1);zeigzahl(werty,2); } void zeigzahl(int zahlz,int daa) { outzi=""; if(zahlz <=9) {outzi+="0";} if(zahlz <=99) {outzi+="0";} if(zahlz <=999) {outzi+="0";} outzi+=String(zahlz); if (daa ==1) {for (byte ixx = 0; ixx < 4; ixx++){display.sendChar (ixx, outzi[ixx]);}} if (daa ==2) {for (byte ix2 = 0; ix2 < 4; ix2++){display.sendChar (ix2+4, outzi[ix2]);}} zahlz=0; } void zeigwort(String woortz,int hier) { if (hier == 1){for (int iqq = 0; iqq < 4; iqq++){display.sendChar (iqq, woortz[iqq]);}} if (hier == 2){for (int iq2 = 0; iq2 < 4; iq2++){display.sendChar (iq2+4, woortz[iq2]);}} woortz=""; } void undlos(String meows,uint8_t dasss) { // for print string to MAX 8dig display meows+=String(dasss); for (int i = 0; i < 8; i++){ display.sendChar (i, meows[i]); } } void keinezeit(uint32_t zeitinsekunden,uint8_t setzden){ outzi=""; if (((zeitinsekunden/60/60)%60) <=9){outzi+="0";} outzi+=String(((zeitinsekunden/60)/60)%60); if (((zeitinsekunden/60)%60) <=9){outzi+="0";} outzi+=String((zeitinsekunden/60)%60); if ((zeitinsekunden%60) <=9){outzi+="0";} outzi+=String(zeitinsekunden%60); if (blinkt >2 && setzden <=6) {outzi[6-setzden]=' ';} for (int i = 0; i < 8; i++){ if (i <=1){display.sendChar (i, outzi[i]);} if (i == 3 || i == 4){display.sendChar (i, outzi[i-1]);} if (i == 6 || i == 7){display.sendChar (i, outzi[i-2]);} if (i == 2 || i == 5){if((runntime%2)==0) {display.sendChar (i, '-');} else{display.sendChar (i, ' ');}} } } void fadefront(long zahl0bis16000) { //duty brightsetter for front leds XD relay goes simpler but fusing mind by find solution with shorter lines just need morwe time than just writ down simple mathe3matic from head.. if (zahl0bis16000 <4000) { if (zahl0bis16000 <800) { dutyf[0]=zahl0bis16000;} else {dutyf[0]=800;} if (zahl0bis16000 >=800 && zahl0bis16000 <1600) { dutyf[1]=zahl0bis16000-800; } if (zahl0bis16000 >=1600) {dutyf[1]=800;} if (zahl0bis16000 >=1600 && zahl0bis16000 <2400) { dutyf[2]=zahl0bis16000-1600;} if (zahl0bis16000 >=2400) {dutyf[2]=800;} if (zahl0bis16000 >=2400 && zahl0bis16000 <3200) { dutyf[3]=zahl0bis16000-2400;} if (zahl0bis16000 >=3200) {dutyf[3]=800;} if (zahl0bis16000 >=3200 && zahl0bis16000 <4000) { dutyf[4]=zahl0bis16000-3200;} if (zahl0bis16000 >=4000) {dutyf[4]=800;} for (uint8_t irgentwas=5; irgentwas <9;irgentwas++) {dutyf[irgentwas]=0;}} if (zahl0bis16000 >4000 && zahl0bis16000 <8000) { if (zahl0bis16000 <=4000) { dutyf[9]=zahl0bis16000-4000;} else {dutyf[9]=800;} if (zahl0bis16000 >=4800 && zahl0bis16000 <5600) { dutyf[8]=zahl0bis16000-4800;} if (zahl0bis16000 >=5600) {dutyf[8]=800;} if (zahl0bis16000 >=5600 && zahl0bis16000 <6400) { dutyf[7]=zahl0bis16000-5600;} if (zahl0bis16000 >=6400) {dutyf[7]=800;} if (zahl0bis16000 >=6400 && zahl0bis16000 <7200) { dutyf[6]=zahl0bis16000-6400;} if (zahl0bis16000 >=7200) {dutyf[6]=800;} if (zahl0bis16000 >=7200 && zahl0bis16000 <8000) { dutyf[5]=zahl0bis16000-7200;} if (zahl0bis16000 >=8000) {dutyf[5]=800;} for (uint8_t irgendwas=0; irgendwas <4;irgendwas++) {dutyf[irgendwas]=800;}} if (zahl0bis16000 >8000 && zahl0bis16000 <12000) { if (zahl0bis16000 <=8800) { dutyf[0]=800-(zahl0bis16000-8000);} else {dutyf[0]=0;} if (zahl0bis16000 >=8800 && zahl0bis16000 <9600) { dutyf[1]=800-(zahl0bis16000-8800 );} if (zahl0bis16000 >=9600 ) {dutyf[1]=0;} if (zahl0bis16000 >=9600 && zahl0bis16000 <10400) { dutyf[2]=800-(zahl0bis16000-9600 );} if (zahl0bis16000 >=10400) {dutyf[2]=0;} if (zahl0bis16000 >=10400 && zahl0bis16000 <11200) { dutyf[3]=800-(zahl0bis16000-10400);} if (zahl0bis16000 >=11200) {dutyf[3]=0;} if (zahl0bis16000 >=11200 && zahl0bis16000 <12000) { dutyf[4]=800-(zahl0bis16000-11200);} if (zahl0bis16000 >=12000) {dutyf[4]=0;} for (uint8_t irgenzwas=5; irgenzwas <9;irgenzwas++) {dutyf[irgenzwas]=800;}} if (zahl0bis16000 >12000 && zahl0bis16000 <16000) { if (zahl0bis16000 <=12800) { dutyf[9]=800-(zahl0bis16000-8000);} else {dutyf[9]=0;} if (zahl0bis16000 >=12800 && zahl0bis16000 <13600) { dutyf[8]=800-(zahl0bis16000-12800);} if (zahl0bis16000 >=13600 ){dutyf[8]=0;} if (zahl0bis16000 >=13600 && zahl0bis16000 <14400) { dutyf[7]=800-(zahl0bis16000-13600);} if (zahl0bis16000 >=14400) {dutyf[7]=0;} if (zahl0bis16000 >=14400 && zahl0bis16000 <15200) { dutyf[6]=800-(zahl0bis16000-14400);} if (zahl0bis16000 >=15200) {dutyf[6]=0;} if (zahl0bis16000 >=15200 && zahl0bis16000 <16000) { dutyf[5]=800-(zahl0bis16000-15200);} if (zahl0bis16000 >=16000) {dutyf[5]=0;} for (uint8_t irgenzwas=0; irgenzwas <4;irgenzwas++) {dutyf[irgenzwas]=00;}} } void rainbowcalc(void) { if(rainbow >=0 && rainbow <=400) {duty[0] =400; duty[1] =rainbow; duty[2] =0;} //rot ->gelb (rotmax grün+ blau0) if(rainbow >=401 && rainbow <=801) {duty[0] =(400 -(rainbow -401)); duty[1] =400; duty[2] =0;} //gelb ->grün (rot- grünmax blau0) if(rainbow >=802 && rainbow <=1202) {duty[0] =0; duty[1] =400; duty[2] =(rainbow - 802);} //grün ->cyan (rot0 grünmax blau+) if(rainbow >=1203 && rainbow <=1603) {duty[0] =0; duty[1] =(400 -(rainbow - 1203)); duty[2] =400;} //cyan ->blau (rot0 grün- blaumax) if(rainbow >=1604 && rainbow <=2004) {duty[0] =(rainbow-1604); duty[1] =0; duty[2] =400;} //blau ->lila (rot+ grün0 blaumax) if(rainbow >=2005 && rainbow <=2405) {duty[0] =400; duty[1] =0; duty[2] =(400- (rainbow -2006));} //lila ->rot (rotmax grün0 blau-) if(rainbow >= 2406) {rainbow =0;} } void machlicht() { rainbowcalc(); if (bright > 400){light=bright-400; darkness=0;} //nur für 3Watt RGB if (bright <=400){darkness=(400-(bright)); light=0;}//nur für 3Watt RGB while ((micros()-startriger) >= 2) { for (int16_t fcount1=0; fcount1 <(802); fcount1++) { if (fcount1 ==0 ) {restaus();} if (fcount1 >=1) { if (fcount1 == ((401+darkness)-duty[0])) { digitalWrite(rot, HIGH );} //3watt RGB if (fcount1 == ((401+darkness)-duty[1])) { digitalWrite(grun, HIGH );}//3watt RGB if (fcount1 == ((401+darkness)-duty[2])) { digitalWrite(blau, HIGH );}//3watt RGB if (fcount1 == ((801)-duty[3])) { digitalWrite(blau1, HIGH );} //3Watt Blau if (fcount1 == ((801)-duty[4])) { digitalWrite(blau2, HIGH );} //3Watt Blau if (fcount1 == ((801)-dutyf[0])) { digitalWrite(rotf1, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[1])) { digitalWrite(rotf2, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[2])) { digitalWrite(rotf3, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[3])) { digitalWrite(rotf4, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[4])) { digitalWrite(rotf5, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[5])) { digitalWrite(blauf1, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[6])) { digitalWrite(blauf2, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[7])) { digitalWrite(blauf3, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[8])) { digitalWrite(blauf4, LOW );} //0603 SMD RGB in front if (fcount1 == ((801)-dutyf[9])) { digitalWrite(blauf5, LOW );}}//0603 SMD RGB in front if (fcount1 >= (402 + light) ) { digitalWrite(rot, LOW ); digitalWrite(grun, LOW ); digitalWrite(blau, LOW );} if (fcount1 >= 800) {restaus(); } } startriger = micros();} } void restaus(void) { digitalWrite(blau1, LOW ); digitalWrite(blau2, LOW ); digitalWrite(rotf1, HIGH ); digitalWrite(rotf2, HIGH ); digitalWrite(rotf3, HIGH ); digitalWrite(rotf4, HIGH ); digitalWrite(rotf5, HIGH ); digitalWrite(blauf1, HIGH ); digitalWrite(blauf2, HIGH ); digitalWrite(blauf3, HIGH ); digitalWrite(blauf4, HIGH ); digitalWrite(blauf5, HIGH ); }