//We always have to include the library #include "LedControl.h" /* Now we need a LedControl to work with. pin 8 is connected to the DataIn pin 10 is connected to the CLK pin 9 is connected to LOAD We have only a single MAX72XX. */ LedControl lc=LedControl(8,10,9,1); /* we always wait a bit between updates of the display */ unsigned long delaytime=100; void setup() { /* The MAX72XX is in power-saving mode on startup, we have to do a wakeup call */ lc.shutdown(0,false); /* Set the brightness to a medium values */ lc.setIntensity(0,8); /* and clear the display */ lc.clearDisplay(0); pinMode(12, OUTPUT); } void testSequence() { // The decimal point is the most significant bit in this whole mess. // Segment g is the least significant bit. byte yautjaDigits[10] = {B00000000, B11110001, B11111101, B10100101, // Yautja digits 0-3 B10111101, B11010111, B10011111, B11010011, // Yautja digits 4-7 B11111101, // Yautja digit 8, which is the same as 2 B11111111 // Yautja digit 9 }; for (int i = 1; i < 10; i++) { lc.setRow(0, 0, yautjaDigits[i]); lc.setRow(0, 1, yautjaDigits[i]); lc.setRow(0, 2, yautjaDigits[i]); lc.setRow(0, 3, yautjaDigits[i]); // Twiddle the LED pin to indicate that I changed something twinkle(); delay(1000); } } void twinkle() { for (int twinkle = 0; twinkle < 6; twinkle++) { digitalWrite(12, LOW); delay(100); digitalWrite(12, HIGH); delay(100); digitalWrite(12, LOW); } } void loop() { lc.clearDisplay(0); digitalWrite(12, LOW); delay(1000); testSequence(); digitalWrite(12, HIGH); delay(1000); }