#include #include #include #include #define screeny 8 const byte chips = 1; // 1 chip, bit banged SPI on pins 6, 7, 8 MAX7219 display (chips, PA4, PA7, PA5); // Chips / LOAD / DIN / CLK CRGB leds[screeny+1]; #define rot PC13 #define grun PC14 #define blau PC15 #define t5 PB12 #define t4 PB13 #define t3 PB14 #define t2 PA12 #define t1 PA15 #define mos PA0 long maintime = micros();long beattime = micros();long sek = millis(); uint16_t wan=30,laag=10,taus=50,onpress[17],p,tc,es,updown,ss; uint32_t ton=300,tof=3000,und[screeny][3]; boolean anaus=false; String outzi=""; void setup(){ FastLED.addLeds(leds, screeny); pinMode(t1,INPUT);pinMode(t2,INPUT);pinMode(t3,INPUT);pinMode(t4,INPUT);pinMode(t5,INPUT);pinMode(rot,OUTPUT);pinMode(blau,OUTPUT);pinMode(grun,OUTPUT);pinMode(mos,OUTPUT);display.begin();} void loop(){zeitreise();} void zeitreise(void){ while ((micros()- maintime) >= 18630) { p++; if(p>=17&&anaus==true){p=0;und[7][1]=250;} if(updown==0){es++;} if(updown==1&&es >0){es--;} if(es>=8){updown=1;ss++;if(ss>=3){ss=0;}} if(es<=0){updown=0;} und[es][ss]=255; istinput(); for(uint8_t c=0;c=30){und[c][d]-=30;} if (und[c][d]>=10){und[c][d]-=10;} if (und[c][d]>0){und[c][d]--;} }} maintime = micros();} while ((micros()- beattime) >= wan*40) { for(uint16_t s=0;s<200 ;s++){ if(anaus ==true){ for(uint16_t d=0;d= 1000) { tc++; if(tc%2==0){und[0][2]=250;und[0][0]=120;} if(tc==0){anaus=true;} if(tc >=ton+tof){tc=0;} tc++;if(tc==ton){anaus=false;}} sek=millis();} void istinput(void){onpress[11]++; if (onpress[11] >2) { if (digitalRead(t1) == HIGH && onpress[0] ==0) { onpress[0] =1;laag++;} if (onpress[0] == 1) { onpress[1]++;} if (onpress[1] >= 3) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0 && laag >0 ) { onpress[2] =1;laag--;} if (onpress[2] == 1) { onpress[3]++;} if (onpress[3] >= 3) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t3) == HIGH && onpress[3] ==0) { onpress[3] =1;if(anaus==false){anaus=true;}else{anaus=false;}} if (onpress[3] == 1) { onpress[4]++;} if (onpress[4] >= 15) { onpress[4] =0; onpress[3]=0; } if (digitalRead(t4) == HIGH && onpress[5] ==0) { onpress[5] =1;taus++;} if (onpress[5] == 1) { onpress[6]++;} if (onpress[6] >= 3) { onpress[6] =0; onpress[5]=0; } if (digitalRead(t5) == HIGH && onpress[7] ==0 && taus >0) { onpress[7] =1;taus--;} if (onpress[7] == 1) { onpress[8]++;} if (onpress[8] >= 3) { onpress[8] =0; onpress[7]=0; } display.begin(); for(uint8_t b = 0 ; b < screeny;b++){leds[b].setRGB(und[b][0],und[b][1],und[b][2]);} FastLED.show(); zeigzahlL(taus);zeigzahlR(laag); if((onpress[0]||onpress[2]||onpress[3]||onpress[5]||onpress[7])==1){und[7][2]=250;} onpress[11]=0; }} void zeigwortuzahl(String wortzz,int zahlzz){ zeigwort(wortzz); zeigzahlR(zahlzz); } void zeigzahlR(int zahlz) { outzi=""; if(zahlz <=9) {outzi+="0";} if(zahlz <=99) {outzi+="0";} if(zahlz <=999) {outzi+="0";} outzi+=String(zahlz); for (byte ixx = 0; ixx < 4; ixx++){display.sendChar (ixx+4, outzi[ixx]);}} void zeigzahlL(int zaalz) { outzi=""; if(zaalz <=9) {outzi+="0";} if(zaalz <=99) {outzi+="0";} if(zaalz <=999) {outzi+="0";} outzi+=String(zaalz); for (byte ixxx = 0; ixxx < 4; ixxx++){display.sendChar (ixxx, outzi[ixxx]);}} void zeigwort(String woortz) { for (int iqq = 0; iqq < 4; iqq++){display.sendChar (iqq, woortz[iqq]);}} void undlos(String meows) { // for print string to MAX 8dig display for (int i = 0; i < 8; i++){ display.sendChar (i, meows[i]); } }