int colAnodes[] = {23, 25, 27};
int rowCathodes[] = {29, 39, 51};
unsigned long nextCharTime = millis() + 500;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println(sizeof(colAnodes) / sizeof(colAnodes[0]));
for (int pointer = 0; pointer <= 2; pointer ++) {
pinMode(colAnodes[pointer], OUTPUT);
digitalWrite(colAnodes[pointer], LOW);
}
Serial.println (sizeof(rowCathodes) / sizeof(rowCathodes[0]));
for (int pointer = 0; pointer <= 2; pointer ++) {
pinMode(rowCathodes[pointer], OUTPUT);
digitalWrite(rowCathodes[pointer], HIGH);
}
}
void loop() {
// put your main code here, to run repeatedly:
if (millis() < nextCharTime){
lightLED(0, 0);
lightLED(0, 1);
lightLED(0, 2);
lightLED(1, 0);
lightLED(1, 2);
lightLED(2, 0);
lightLED(2, 1);
lightLED(2, 2);
} else{
nextCharTime = millis() + 500;
}
if (millis() < nextCharTime){
lightLED(0, 0);
lightLED(1, 1);
lightLED(2, 0);
lightLED(0, 2);
lightLED(2, 2);
} else{
nextCharTime = millis() + 500;
}
void lightLED(int col, int row) {
for (int pointer = 0; pointer <= (sizeof(colAnodes) / sizeof(colAnodes[0])) - 1; pointer ++) {
pinMode(rowCathodes[pointer], OUTPUT);
digitalWrite(rowCathodes[pointer], HIGH);
}
for (int pointer = 0; pointer <= (sizeof(colAnodes) / sizeof(colAnodes[0])) - 1; pointer ++) {
pinMode(colAnodes[pointer], OUTPUT);
digitalWrite(colAnodes[pointer], LOW);
}
digitalWrite(colAnodes[col], HIGH);
digitalWrite(rowCathodes[row], LOW);
}