I learned quite a bit from this page:
http://allaboutee.com/2011/07/09/arduino-4-digit-7-segment-display-tutorial/
Specifically how a simplified way to toggle the digital pins.
I wired up the pins similar to how the tutorial describes, except I only have one of the digits active right now until i can find a couple more resistors. I eliminated pin 8. So far so good, I have the first (far right) digit counting down from 9 to 0 each second
New code: (this snippet just displays "3" on the first digit, but you should get the general idea)
----------------------------------------------
// 1 = PORTD=B11001111;
// 2 = PORTD=B11001110;
// 3 = PORTD=B10000110;
int d1=9,d2=10,d3=11,d4=12;
int tick=5;
void setup()
{
DDRD=0xff; // all pins 0-7 OUTPUTs
DDRB=0xff; // all pins 8-13 OUTPUTs even though we only use pins 8-12
PORTD=0x00; // make pins 0-7 LOWs
PORTB=0x00; // make pins 8-13 LOWs
}
void loop()
{
digitalWrite(d2,LOW);
digitalWrite(d3,LOW);
digitalWrite(d4,LOW);
digitalWrite(d1,HIGH);
PORTD=B10111111;delay(tick);
PORTD=B11011111;delay(tick);
PORTD=B11101111;delay(tick);
PORTD=B11110111;delay(tick);
PORTD=B11111110;
// digitalWrite(8,HIGH);
delay(tick);
}
----------------------------------------------