Just had to update this. I was able to add another digit and create a little routine that counts down from 99 to 0 and repeats the cycle. Now that I've done 2 digits, I should hopefully be able to complete the remaining 6. Here's a video link and the code.
By the way - the LedControl library makes this so much easier.
Quick video:
The code:
#include "LedControl.h" // need the library
LedControl lc=LedControl(12,11,10,1); // lc is our object
// pin 12 is connected to the MAX7219 pin 1
// pin 11 is connected to the CLK pin 13
// pin 10 is connected to LOAD pin 12
// 1 as we are only using 1 MAX7219
void setup()
{
// the zero refers to the MAX7219 number, it is zero for 1 chip
lc.shutdown(0,false);// turn off power saving, enables display
lc.setIntensity(0,8);// sets brightness (0~15 possible values)
lc.clearDisplay(0);// clear screen
}
void loop()
{
//This code should count down from 99 displaying the numbers on the two digits
static int theNumber = 99;
int digitOne, digitTwo;
if (theNumber < 0)
theNumber = 99;
if (theNumber > 9)
{
float result = theNumber / 10; //s/b 4.2 resulting in 4
digitOne = result;
digitTwo = theNumber % 10; //this gets the remainder of 42/10 or 2
}
else
{
digitOne = 0;
digitTwo = theNumber;
}
lc.setDigit(0,0,digitOne,false);
lc.setDigit(0,1,digitTwo,false);
delay(100);
theNumber --;
}