Last active
August 29, 2015 14:02
-
-
Save hcwiley/e7ae202d0ca46231a982 to your computer and use it in GitHub Desktop.
8x8 matrix tester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int row[8] = {7, 9, 6, 8, 2, 5, 3, 4}; | |
int col[8] = {15, 10, 11, 13, 12, 14, 16, 17}; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// open a serial port | |
Serial.begin(9600); | |
// initialize the row and column pins as outputs, set rows low, set columns high | |
for (int i = 0; i < 8; i++) { | |
pinMode (row[i], OUTPUT); | |
digitalWrite(row[i], LOW); | |
pinMode (col[i], OUTPUT); | |
digitalWrite(col[i], HIGH); | |
} | |
// test all leds | |
for (int r=0; r<8; r++) { | |
if (r > 0) { | |
digitalWrite(row[r-1], LOW); | |
} | |
else { | |
digitalWrite(row[7], LOW); | |
} | |
digitalWrite(row[r], HIGH); | |
for (int c = 0; c<8; c++) { | |
if (c > 0) { | |
digitalWrite(col[c-1], HIGH); | |
} | |
else { | |
digitalWrite(col[7], HIGH); | |
} | |
digitalWrite(col[c], LOW); | |
delay(20); | |
} | |
} | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment