Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define rows 7
- #define rows_offset 2
- #define cols 5
- #define cols_offset 9
- #define blue 11
- const int lowestPin = 0;
- const int highestPin = 13;
- int steps = 0;
- int Matrix[6][rows][cols] = {
- {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 0},
- {0, 1, 1, 1, 0},
- {0, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- {
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- },
- {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 0},
- {0, 1, 1, 1, 0},
- {0, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- },
- {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- },
- {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 1, 0},
- {1, 0, 1, 0, 0},
- {1, 1, 0, 0, 0},
- {1, 0, 1, 0, 0},
- {1, 0, 0, 1, 0},
- {1, 0, 0, 0, 1},
- },
- {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- }
- };
- int MatrixS[rows][cols] = {
- {0, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 0},
- {0, 1, 1, 1, 0},
- {0, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {0, 1, 1, 1, 0},
- };
- int MatrixP[rows][cols] = {
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 1},
- {1, 0, 0, 0, 1},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- };
- int MatrixE[rows][cols] = {
- {1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 0},
- {1, 0, 0, 0, 0},
- {1, 0, 0, 0, 0},
- {1, 1, 1, 1, 1},
- };
- int MatrixK[rows][cols] = {
- {1, 0, 0, 0, 1},
- {1, 0, 0, 1, 0},
- {1, 0, 1, 0, 0},
- {1, 1, 0, 0, 0},
- {1, 0, 1, 0, 0},
- {1, 0, 0, 1, 0},
- {1, 0, 0, 0, 1},
- };
- void setup() {
- for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++) {
- pinMode(thisPin, OUTPUT);
- }
- }
- void loop() {
- steps++;
- int c = (steps / 100) % 6;
- for (int row = 0; row < rows; row++) {
- digitalWrite(row + rows_offset, LOW);
- for (int col = 0; col < cols; col++) {
- digitalWrite(col + cols_offset, Matrix[c][row][col]);
- }
- delay(1);
- digitalWrite(row + rows_offset, HIGH);
- }
- /* for (int row = rows_offset; row < rows+rows_offset; row++ ) {
- digitalWrite(row, HIGH);
- for (int col = cols_offset; col < cols + cols_offset; col++) {
- digitalWrite(col, LOW);
- delay(200);
- }
- }*/
- /* for (int i = 8; i <= 13; i++) {
- digitalWrite(i, HIGH);
- }
- for (int i = 2; i < 9; i++) {
- digitalWrite(i, LOW);
- }
- delay(500);
- for (int i = 2; i < 9; i++) {
- digitalWrite(i, HIGH);
- }
- for (int i = 9; i <= 13; i++) {
- digitalWrite(i, LOW);
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement