LED cube explosion

Source code

int Columns[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int Rows[] = {12, 11, 10}; int t=400; void setup() { int Counter; for (int Counter = 0; Counter < 10; Counter++){ pinMode(Columns[Counter], OUTPUT); } for (int Counter = 0; Counter < 4; Counter++){ pinMode(Rows[Counter], OUTPUT); } } void loop() { digitalWrite(Rows[1], HIGH); digitalWrite(Columns[4], HIGH); delay(t); for(int i=0;i<t;i++){ if(i%2==0){ digitalWrite(Rows[0], LOW); digitalWrite(Rows[2], LOW); digitalWrite(Columns[1], HIGH); digitalWrite(Columns[3], HIGH); digitalWrite(Columns[5], HIGH); digitalWrite(Columns[7], HIGH); } else { digitalWrite(Columns[1], LOW); digitalWrite(Columns[3], LOW); digitalWrite(Columns[5], LOW); digitalWrite(Columns[7], LOW); digitalWrite(Rows[0], HIGH); digitalWrite(Rows[2], HIGH); } delay(1); } for(int j=0; j<t; j++){ if(j%2==0){ digitalWrite(Columns[0], LOW); digitalWrite(Columns[2], LOW); digitalWrite(Columns[8], LOW); digitalWrite(Columns[6], LOW); digitalWrite(Rows[0], HIGH); digitalWrite(Rows[2], HIGH); digitalWrite(Columns[1], HIGH); digitalWrite(Columns[3], HIGH); digitalWrite(Columns[5], HIGH); digitalWrite(Columns[7], HIGH); } else { digitalWrite(Rows[0], LOW); digitalWrite(Rows[2], LOW); digitalWrite(Columns[0], HIGH); digitalWrite(Columns[2], HIGH); digitalWrite(Columns[8], HIGH); digitalWrite(Columns[6], HIGH); } delay(1); } digitalWrite(Rows[0], HIGH); digitalWrite(Rows[2], HIGH); delay(t); for (int Counter = 0; Counter < 10; Counter++){ digitalWrite(Columns[Counter], LOW); } for (int Counter = 0; Counter < 4; Counter++){ digitalWrite(Rows[Counter], LOW); } }

Leave a Reply

The best way to predict the future is to invent it (Alan Kay)