15. November 2011
Ein wiederholendes LED Muster:int counter = 0; int steps = 30; boolean flag = false; int col[5] = { 12, 11, 10, 9, 8}; int row[7] = { 7, 6, 5, 4, 3, 2, 1}; void setup(){ for(int i=12; i>=1; i--){ pinMode(i,OUTPUT); } for(int i=0; i<5; i++){ digitalWrite(col[i], HIGH); } } void loop(){ if(counter > steps && counter < steps*8) pulseLED(2,3); if(counter > steps*2 && counter < steps*9){ pulseLED(2,2); pulseLED(2,4); } if(counter > steps*3 && counter < steps*10){ pulseLED(3,3); pulseLED(1,3); } if(counter > steps*4 && counter < steps*11){ pulseLED(2,1); pulseLED(2,5); } if(counter > steps*5 && counter < steps*12){ pulseLED(0,3); pulseLED(4,3); pulseLED(1,2); pulseLED(3,2); pulseLED(1,4); pulseLED(3,4); } if(counter > steps*6 && counter < steps*13){ pulseLED(3,4); pulseLED(2,0); pulseLED(2,6); pulseLED(3,1); pulseLED(1,1); pulseLED(3,5); pulseLED(1,5); } if(counter > steps*7 && counter < steps*14){ pulseLED(0,2); pulseLED(0,4); pulseLED(4,2); pulseLED(4,4); } if(counter > steps*15 && counter < steps*17){ pulseLED(1,0); pulseLED(0,1); pulseLED(3,0); pulseLED(4,1); pulseLED(4,5); pulseLED(3,6); pulseLED(1,6); pulseLED(0,5); } if(counter > steps*16){ pulseLED(0,0); pulseLED(4,0); pulseLED(4,6); pulseLED(0,6); } if(counter == steps*19) counter=0; counter++; } void pulseLED(int c, int r){ digitalWrite(col, LOW); digitalWrite(row[r], HIGH); delayMicroseconds(100); digitalWrite(col, HIGH); digitalWrite(row[r], LOW); }