Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //delay time
- int delay1 = 5;
- //count to determine the number of rows to draw
- int count = 0;
- //width of array
- int width = 57;
- //matrix of values to draw
- int ledarray[8][57]={
- {0,1,0,0,1,0,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,1,1,1,0,1,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,0,0,1,0,0,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0}
- //1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0, numbers for reference of width
- };
- void setup()
- {
- //initialise all the pins used for LEDs as outputs
- for (int pincount = 1; pincount < 9; pincount++)
- {
- pinMode(pincount, OUTPUT);
- }
- }
- //loop runs over and over after setup
- void loop()
- {
- if(count == width) //if the whole array has been drawn
- {
- count = 0; //reset and draw again
- }
- else
- {
- flash(count); //else draw the next row
- count++; //and increment count
- }
- delay(delay1); //delay between LED flashes
- }
- void alloff () //method to turn all LED's off, never used
- {
- for (int pincount1 = 1; pincount1 < 9; pincount1++)
- {
- digitalWrite(pincount1, LOW);
- }
- }
- void allon () //method to turn all LED's on, never used
- {
- for (int pincount2 = 1; pincount2 < 9; pincount2++)
- {
- digitalWrite(pincount2, HIGH);
- }
- }
- void flash (int row) //fairly simple method to flash a row of LED's
- {
- for (int count1 = 1; count1 < 9; count1++)
- if (ledarray[count1-1][row] == 1)
- {
- digitalWrite(count1, HIGH); //if the array states to, turn the Nth LED on
- }
- else
- {
- digitalWrite(count1, LOW); //if the array states to, turn the Nth LED on
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement