Okay, here's my code:
int hours = 0;
int minutes = 0;
int seconds = 0;
void setup() {
// put your setup code here, to run once:
//Serial.begin(115200);
TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 3036;
TCCR1B |= (1<<CS12);
TIMSK1 |= (1<<TOIE1);
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
pinMode(A4, OUTPUT);
pinMode(A5, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13,0);
}
ISR(TIMER1_OVF_vect) {
//unsigned long timee = millis();
//Serial.print(timee);
/*
if (timee % 1000 > 0 && timee % 1000 < 500) {
TCNT1 = 3068;
} else if (timee % 1000 > 500 && timee % 1000 != 0) {
TCNT1 = 3004;
} else {
TCNT1 = 3036;
}
*/
seconds += 1;
if (seconds == 60) {
seconds = 0;
minutes += 1;
if (minutes == 60) {
minutes = 0;
hours += 1;
if (hours == 24) {
hours = 0;
}
}
}
//Serial.print(" | ");Serial.print(hours);Serial.print(":");Serial.print(minutes);Serial.print(":");Serial.println(seconds);
digitalWrite(A5, HIGH && (seconds & B00000001));
digitalWrite(A4, HIGH && (seconds & B00000010));
digitalWrite(A3, HIGH && (seconds & B00000100));
digitalWrite(11, HIGH && (seconds & B00001000));
digitalWrite(10, HIGH && (seconds & B00010000));
digitalWrite(9, HIGH && (seconds & B00100000));
digitalWrite(2, HIGH && (minutes & B00000001));
digitalWrite(3, HIGH && (minutes & B00000010));
digitalWrite(4, HIGH && (minutes & B00000100));
digitalWrite(5, HIGH && (minutes & B00001000));
digitalWrite(6, HIGH && (minutes & B00010000));
digitalWrite(7, HIGH && (minutes & B00100000));
digitalWrite(A0, HIGH && (hours & B00000001));
digitalWrite(A1, HIGH && (hours & B00000010));
digitalWrite(A2, HIGH && (hours & B00000100));
digitalWrite(12, HIGH && (hours & B00001000));
digitalWrite(13, HIGH && (hours & B00010000));
}
void loop() {
// put your main code here, to run repeatedly:
};
and my schematic is simply every pin of the arduino (I'm using a standalone atmega328, but the issue is the same with the board) connected directly to the anode of an LED, and a common cathode within the color groups (I have 3 colors, red, blue, and white) and a resistor (1kohm red, 220ohm for white, and 1k0hm for blue, my LEDs appear to be low quality because the voltages between them seems skewed (red needs lowest, blue needs highest, opposite of normal, right?)) betwen each of those common anodes and ground.