5x5x5 LedCube

5x5x5 Led Cube
1zFYon6LY4E

Juhu der groessere Bruder ist da xD endlich genug Pins um den 5x5x5 komplett anzusteuern

--Talisman 17:38, 28 February 2010 (UTC)

schaltung:

der wuerfel 5x5x5 (5 Anoden 25 Kathoden) jeweils pro ausgang am wuerfel ein pin

3x drehpoti 10k + 1x schiebepoti 1k diese sind jeweils an einen analogen eingang angeschlossen und liefern linearen wert zurueck

zb um das delay einzustellen oder durch die programme zu wechseln

Bauphase:
 * http://www.h23.org/ledcube/

code:  int sensorPin = 0; int sensorValue = 0; int sensorMin = 0; int sensorMax = 1023; int sensorPin2 = 1; int sensorValue2 = 0; int sensorMin2 = 0; int sensorMax2 = 1023; int sensorPin3 = 2; int sensorValue3 = 0; int sensorMin3 = 0; int sensorMax3 = 1023; int sensorPin4 = 3; int sensorValue4 = 0; int sensorMin4 = 0; int sensorMax4 = 1023;

// Anoden der 125 LEDs int anode[] = { 8, 9, 10, 11, 12};

int R;

// 5 Kathodenebenen int ce1[] = { 22, 23, 24, 25, 26}; int ce2[] = { 30, 31, 32, 33, 34}; int ce3[] = { 38, 39, 40, 41, 42}; int ce4[] = { 46, 47, 48, 49, 50}; int ce5[] = { 70, 71, 72, 73, 74}; // alle Kathodenebenen int ce[] = { 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 38, 39, 40, 41, 42, 46, 47, 48, 49, 50,70, 71, 72, 73, 74};

// 5 Kathodenflächen int cf1[] = { 22, 30, 38, 46, 70}; int cf2[] = { 23, 31, 39, 47, 71}; int cf3[] = { 24, 32, 40, 48, 72}; int cf4[] = { 25, 33, 41, 49, 73}; int cf5[] = { 26, 34, 42, 50, 74}; // alle Kathodenflächen int cf[] = { 22, 30, 38, 46, 70, 23, 31, 39, 47, 71, 24, 32, 40, 48, 72, 25, 33, 41, 49, 73, 26, 34, 42, 50, 74};

/// zur fehler suche long heartBeatArray[] = { 50, 100, 15, 1200}; int hbeatIndex = 1;  // this initialization is important or it starts on the "wrong foot" long prevMillis;

void setup { randomSeed(analogRead(15));  //// hier wird random initizialisiert, nicht aendern!!!! for (int a = 0; a < 5; a++) { // Alle Anoden auf OUTPUT pinMode(anode[a], OUTPUT); } for (int c = 0; c < 25; c++) {         // Alle Kathoden auf OUTPUT pinMode(ce[c], OUTPUT); digitalWrite(ce[c], HIGH);    // Alles ausstellen }

}

void loop {

sensorValue = analogRead(sensorPin); sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 1023); sensorValue = constrain(sensorValue, 0, 1023); sensorValue2 = analogRead(sensorPin2); sensorValue2 = map(sensorValue2, sensorMin2, sensorMax2, 0, 255); sensorValue2 = constrain(sensorValue2, 0, 255); sensorValue3 = analogRead(sensorPin3); sensorValue3 = map(sensorValue3, sensorMin3, sensorMax3, 0, 27); sensorValue3 = constrain(sensorValue3, 0, 27); sensorValue4 = analogRead(sensorPin4); sensorValue4 = map(sensorValue4, sensorMin4, sensorMax4, 0, 27); sensorValue4 = constrain(sensorValue4, 0, 27);

int PW; PW = (sensorValue4); switch (PW) { case 0: ///alle Potis auf null und anmachen hier ist start (spielplatz)

ebene(1, 1); d1; aus; ebene(2, 2); d1; aus; ebene(3, 3); d1; aus; ebene(4, 4); d1; aus; ebene(5, 5); d1; aus;

//// ende spielplatz

break; case 1: fa1random; break; case 2: ff1random; break; case 3:

R = random(1, 3); switch(R){ case 1: fa1random; break; case 2: ff1random; break; }

break; case 4: fa2random; break; case 5: ff2random; break; case 6:

R = random(1, 3); switch(R){ case 1: fa2random; break; case 2: ff2random; break; }

break; case 7:

R = random(1, 5); switch(R){ case 1: fa1random; break; case 2: ff2random; break; case 3: fa1random; break; case 4: ff2random; break; }

break; case 8:

R = random(0, 3); switch (R){ case 0: ebene(random(1, 6),random(1, 6)); d1; aus; break; case 1: flaeche(random(1, 6),random(1, 6)); d1; aus; break; case 2: reihe(random(1, 26),0); d1; aus; break; }

break; default: aus; break; }

int PW2; PW2 = (sensorValue3); switch (PW2) { case 0: aus; break; case 1: f1; break; case 2: f2; break; case 3: f1; f2; break; case 4: f1; f2; f2; f1; break; case 5:

R = random(1, 3); switch (R){ case 1: f1; break; case 2: f2; break; }

break; default: aus; break; } }

///////////////////////////////// ///// void zone!!!!!///////////// ///// void zone!!!!!///////////// ///// void zone!!!!!///////////// //////////////////////////////// void d1{ delay(sensorValue); sensorValue = analogRead(sensorPin); sensorValue2 = analogRead(sensorPin2); sensorValue3 = analogRead(sensorPin3); sensorValue4 = analogRead(sensorPin4); }

void anaus(int x) { switch (x){ case 0: aus; break; case 1: an; break; case 2:

R = random (1, 3); switch (R){ case 1: an; break; case 2: aus; break; }

break; } } void heartBeat(float tempo){ if ((millis - prevMillis) > (long)(heartBeatArray[hbeatIndex] * tempo)){ hbeatIndex++; if (hbeatIndex > 3) hbeatIndex = 0; if ((hbeatIndex % 2) == 0){ an; delay((int)heartBeatArray[hbeatIndex]) ; aus; }   hbeatIndex++; prevMillis = millis; } } ///// ebene (1 oben - 5 unten, 0 alle 1 links - 5 rechts) void ebene(int a, int b) { switch (b){ case 0: digitalWrite(8,HIGH); digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH); break; case 1: digitalWrite(8,HIGH); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 2: digitalWrite(8,LOW); digitalWrite(9,HIGH); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 3: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,HIGH); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 4: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,HIGH); digitalWrite(12,LOW); break; case 5: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,HIGH); break; } switch (a) { case 1: digitalWrite(22,LOW); digitalWrite(23,LOW); digitalWrite(24,LOW); digitalWrite(25,LOW); digitalWrite(26,LOW); break; case 2: digitalWrite(30,LOW); digitalWrite(31,LOW); digitalWrite(32,LOW); digitalWrite(33,LOW); digitalWrite(34,LOW); break; case 3: digitalWrite(38,LOW); digitalWrite(39,LOW); digitalWrite(40,LOW); digitalWrite(41,LOW); digitalWrite(42,LOW); break; case 4: digitalWrite(46,LOW); digitalWrite(47,LOW); digitalWrite(48,LOW); digitalWrite(49,LOW); digitalWrite(50,LOW); break; case 5: digitalWrite(70,LOW); digitalWrite(71,LOW); digitalWrite(72,LOW); digitalWrite(73,LOW); digitalWrite(74,LOW); break; default: heartBeat(1.0); break; } } ///// flaeche (1 hinten - 5 vorn, 0 alle 1 rechts - 5 links) void flaeche(int a, int b) { switch (b){ case 0: digitalWrite(8,HIGH); digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH); break; case 1: digitalWrite(8,HIGH); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 2: digitalWrite(8,LOW); digitalWrite(9,HIGH); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 3: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,HIGH); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 4: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,HIGH); digitalWrite(12,LOW); break; case 5: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,HIGH); break; } switch (a) { case 1: digitalWrite(22,LOW); digitalWrite(30,LOW); digitalWrite(38,LOW); digitalWrite(46,LOW); digitalWrite(70,LOW); break; case 2: digitalWrite(23,LOW); digitalWrite(31,LOW); digitalWrite(39,LOW); digitalWrite(47,LOW); digitalWrite(71,LOW); break; case 3: digitalWrite(24,LOW); digitalWrite(32,LOW); digitalWrite(40,LOW); digitalWrite(48,LOW); digitalWrite(72,LOW); break; case 4: digitalWrite(25,LOW); digitalWrite(33,LOW); digitalWrite(41,LOW); digitalWrite(49,LOW); digitalWrite(73,LOW); break; case 5: digitalWrite(26,LOW); digitalWrite(34,LOW); digitalWrite(42,LOW); digitalWrite(50,LOW); digitalWrite(74,LOW); break; default: heartBeat(1.0); break; } } // reihe 25 0-5 mit null ganze reihe 1-5 jeweils die einzelne LED dieser reihe void reihe(int a, int b) { switch (b){ case 0: digitalWrite(8,HIGH); digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH); break; case 1: digitalWrite(8,HIGH); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 2: digitalWrite(8,LOW); digitalWrite(9,HIGH); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 3: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,HIGH); digitalWrite(11,LOW); digitalWrite(12,LOW); break; case 4: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,HIGH); digitalWrite(12,LOW); break; case 5: digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,HIGH); break; } switch (a) { case 1: digitalWrite(22,LOW); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 2: digitalWrite(22,HIGH); digitalWrite(23,LOW); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 3: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,LOW); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 4: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,LOW); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 5: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,LOW); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 6: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,LOW); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 7: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,LOW); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 8: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,LOW); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 9: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,LOW); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 10: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,LOW); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 11: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,LOW); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 12: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,LOW); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 13: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,LOW); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 14: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,LOW); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 15: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,LOW); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 16: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,LOW); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 17: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,LOW); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 18: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,LOW); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 19: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,LOW); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 20: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,LOW); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 21: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,LOW); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 22: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,LOW); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 23: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,LOW); digitalWrite(73,HIGH); digitalWrite(74,HIGH); break; case 24: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,LOW); digitalWrite(74,HIGH); break; case 25: digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH); digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH); digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH); digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH); digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,LOW); break;

default: heartBeat(1.0); break; } }

void fa1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce1[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce1[c], HIGH); }  } }

void fb1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce2[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce2[c], HIGH); } } }

void fc1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce3[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce3[c], HIGH); } } }

void fd1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce4[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce4[c], HIGH); } } } void fe1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce5[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce5[c], HIGH); } } } void fa1random{ R = random(1, 6); switch (R) { case 1: fa1; break; case 2: fb1; break; case 3: fc1; break; case 4: fd1; break; case 5: fe1; break; } } void ff1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf1[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf1[c], HIGH); } } } void fg1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf2[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf2[c], HIGH); } } } void fh1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf3[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf3[c], HIGH); } } } void fi1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf4[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf4[c], HIGH); } } } void fj1 { for(int c = 0; c < 5; c++) {         // Alle Ebenen nacheinander for(int a = 0; a < 5; a++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf5[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf5[c], HIGH); } } } void ff1random{ R = random(1, 6); switch (R) { case 1: ff1; break; case 2: fg1; break; case 3: fh1; break; case 4: fi1; break; case 5: fj1; break; } } void fa2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce1[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce1[c], HIGH); } } } void fb2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce2[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce2[c], HIGH); } } } void fc2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce3[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce3[c], HIGH); } } } void fd2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce4[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce4[c], HIGH); } } } void fe2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(ce5[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(ce5[c], HIGH); } } } void fa2random{ R = random(1, 6); switch (R) { case 1: fa2; break; case 2: fb2; break; case 3: fc2; break; case 4: fd2; break; case 5: fe2; break; } } void ff2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf1[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf1[c], HIGH); } } } void fg2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf2[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf2[c], HIGH); } } } void fh2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf3[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf3[c], HIGH); } } } void fi2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf4[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf4[c], HIGH); } } } void fj2 { for(int a = 0; a < 5; a++) {         // Alle Ebenen nacheinander for(int c = 0; c < 5; c++) {       // Alle LEDs einer Ebene nacheinander digitalWrite(anode[a], HIGH);    // LED anschalten digitalWrite(cf5[c], LOW); d1; digitalWrite(anode[a], LOW);     // LED ausschalten digitalWrite(cf5[c], HIGH); } } } void ff2random{ R = random(1, 6); switch (R) { case 1: ff2; break; case 2: fg2; break; case 3: fh2; break; case 4: fi2; break; case 5: fj2; break; } } void f2{ for(int a = 21; a > 0; a--){ switch (a) {   case 1: fa1; break; case 2: fb1; break; case 3: fc1; break; case 4: fd1; break; case 5: fe1; break; case 6: ff1; break; case 7: fg1; break; case 8: fh1; break; case 9: fi1; break; case 10: fj1; break; case 11: fa2; break; case 12: fb2; break; case 13: fc2; break; case 14: fd2; break; case 15: fe2; break; case 16: ff2; break; case 17: fg2; break; case 18: fh2; break; case 19: fi2; break; case 20: fj2; break; }   } }  void f1{ for(int a = 0; a < 21; a++){ switch (a) {   case 1: fa1; break; case 2: fb1; break; case 3: fc1; break; case 4: fd1; break; case 5: fe1; break; case 6: ff1; break; case 7: fg1; break; case 8: fh1; break; case 9: fi1; break; case 10: fj1; break; case 11: fa2; break; case 12: fb2; break; case 13: fc2; break; case 14: fd2; break; case 15: fe2; break; case 16: ff2; break; case 17: fg2; break; case 18: fh2; break; case 19: fi2; break; case 20: fj2; break; }   } } void an{ digitalWrite(8,HIGH); digitalWrite(9,HIGH); digitalWrite(10,HIGH); digitalWrite(11,HIGH); digitalWrite(12,HIGH);

digitalWrite(22,LOW); digitalWrite(23,LOW); digitalWrite(24,LOW); digitalWrite(25,LOW); digitalWrite(26,LOW);

digitalWrite(30,LOW); digitalWrite(31,LOW); digitalWrite(32,LOW); digitalWrite(33,LOW); digitalWrite(34,LOW);

digitalWrite(38,LOW); digitalWrite(39,LOW); digitalWrite(40,LOW); digitalWrite(41,LOW); digitalWrite(42,LOW);

digitalWrite(46,LOW); digitalWrite(47,LOW); digitalWrite(48,LOW); digitalWrite(49,LOW); digitalWrite(50,LOW);

digitalWrite(70,LOW); digitalWrite(71,LOW); digitalWrite(72,LOW); digitalWrite(73,LOW); digitalWrite(74,LOW); } void aus{ digitalWrite(8,LOW); digitalWrite(9,LOW); digitalWrite(10,LOW); digitalWrite(11,LOW); digitalWrite(12,LOW);

digitalWrite(22,HIGH); digitalWrite(23,HIGH); digitalWrite(24,HIGH); digitalWrite(25,HIGH); digitalWrite(26,HIGH);

digitalWrite(30,HIGH); digitalWrite(31,HIGH); digitalWrite(32,HIGH); digitalWrite(33,HIGH); digitalWrite(34,HIGH);

digitalWrite(38,HIGH); digitalWrite(39,HIGH); digitalWrite(40,HIGH); digitalWrite(41,HIGH); digitalWrite(42,HIGH);

digitalWrite(46,HIGH); digitalWrite(47,HIGH); digitalWrite(48,HIGH); digitalWrite(49,HIGH); digitalWrite(50,HIGH);

digitalWrite(70,HIGH); digitalWrite(71,HIGH); digitalWrite(72,HIGH); digitalWrite(73,HIGH); digitalWrite(74,HIGH);

}

