Skip to content

Instantly share code, notes, and snippets.

@JBou
Created Nov 9, 2015
Embed
What would you like to do?
int row[] = {2, 3, 4, 5, 6, 7, 8, 9};
int column[] = {10, 11, 12, 13, A0, A1, A2, A3};
//int buffer[8][8];
int lastRow;
int lastColumn;
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < 8; i++) {
pinMode(row[i], OUTPUT);
rowSet(i, LOW);
pinMode(column[i], OUTPUT);
columnSet(i, LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < 8; i++) {
rowSet(lastRow, LOW);
rowSet(i, HIGH);
for (int j = 0; j < 8; j++) {
columnSet(j, HIGH);
delay(50);
lastColumn = j;
columnSet(lastColumn, LOW);
}
lastRow = i;
}
}
void matrix() {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
//buffer[i][j]
}
}
}
void rowSet(int index, boolean state) {
digitalWrite(row[index], state);
}
void columnSet(int index, boolean state) {
if (index > 3) {
analogWrite(column[index], state == HIGH ? 0 : 1024);
} else {
digitalWrite(column[index], !state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment