MD_MAX72xx LED Matrix Display Library and Digispark TINY85

I am trying to use the Digispark TINY85 to drive a generic MAX7912 LED Matrix module with the MD_MAX72xx library.

I have the TINY85 set up with the Arduino IDE. It successfully compiles & uploads this Digispark demo sketch which flashes a LED on the TINY85:

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(0, OUTPUT); //LED on Model B
  pinMode(1, OUTPUT); //LED on Model A  or Pro
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(0, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(1, HIGH);
  delay(1000);               // wait for a second
  digitalWrite(0, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(1, LOW); 
  delay(1000);               // wait for a second
}

I have tried to get the 'MD_MAX72XX_Test' example sketch to compile, but the IDE throws a load of errors:

/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp: In member function 'void MD_MAX72XX::begin()':
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:65:17: error: 'SS' was not declared in this scope
    digitalWrite(SS, HIGH);

                 ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:67:12: error: 'MOSI' was not declared in this scope
    pinMode(MOSI, OUTPUT);

            ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:68:12: error: 'SCK' was not declared in this scope
    pinMode(SCK, OUTPUT);

            ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:78:4: error: 'SPCR' was not declared in this scope
    SPCR |= _BV(MSTR);

    ^
In file included from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/interrupt.h:38,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/WProgram.h:8,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/Arduino.h:4,
                 from /home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:24:
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:78:16: error: 'MSTR' was not declared in this scope
    SPCR |= _BV(MSTR);

                ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:79:16: error: 'SPE' was not declared in this scope
    SPCR |= _BV(SPE);

                ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:82:19: error: 'DORD' was not declared in this scope
     SPCR &= ~(_BV(DORD));

                   ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp: In destructor 'MD_MAX72XX::~MD_MAX72XX()':
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:143:5: error: 'SPCR' was not declared in this scope
     SPCR &= ~_BV(SPE); // reset SPI mode

     ^
In file included from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/interrupt.h:38,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/WProgram.h:8,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/Arduino.h:4,
                 from /home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:24:
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:143:18: error: 'SPE' was not declared in this scope
     SPCR &= ~_BV(SPE); // reset SPI mode

                  ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp: In member function 'void MD_MAX72XX::spiSend()':
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:328:6: error: 'SPDR' was not declared in this scope
      SPDR = _spiData[i];

      ^
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:329:15: error: 'SPSR' was not declared in this scope
      while (!(SPSR & _BV(SPIF))) // wait for a clear bit

               ^
In file included from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /home/zzz/Downloads/arduino-1.6.7/hardware/tools/avr/avr/include/avr/interrupt.h:38,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/WProgram.h:8,
                 from /home/zzz/.arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny/Arduino.h:4,
                 from /home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:24:
/home/zzz/Arduino/libraries/MD_MAX72xx/src/MD_MAX72xx.cpp:329:26: error: 'SPIF' was not declared in this scope
      while (!(SPSR & _BV(SPIF))) // wait for a clear bit

                          ^
exit status 1
Error compiling.

I have made the following changes to MD_MAX72xx.h:

#define USE_PAROLA_HW 0
#define USE_GENERIC_HW 1

and changed the pin definitions in 'MD_MAX72XX_Test':

// DIGISPARK ATTINY85 PINOUT: 
#define CLK_PIN   2  // DataIn
#define DATA_PIN  1  // CLK
#define CS_PIN    0  // LOAD/CS

I tried changing

#define	USE_LIBRARY_SPI	0

but no change.

The error messages seem to suggest that I need to include a library or something?
I have no idea what.

I'm a newbie and probably overlooking something obvious??

Are you using the latest libraries from the download site?

marco_c:
Are you using the latest libraries from the download site?

As far as I know.

The Arduino IDE notifies when updates are available, which I install.

The MD libraries are not automatically notified. Please make sure you get the latest and try again with that one.

marco_c:
The MD libraries are not automatically notified. Please make sure you get the latest and try again with that one.

I reinstalled the Arduino IDE and the MD_MAX72xx library and still get the same result.

I tried changing the target board to "Arduino Nano" and it verifies with a few warnings:

/home/zzz/Arduino/libraries/MD_MAX72xx/examples/MD_MAX72xx_Test/MD_MAX72xx_Test.ino: In function 'void loop()':
/home/zzz/Arduino/libraries/MD_MAX72xx/examples/MD_MAX72xx_Test/MD_MAX72xx_Test.ino:613:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   scrollText("Graphics  ");

                          ^
/home/zzz/Arduino/libraries/MD_MAX72xx/examples/MD_MAX72xx_Test/MD_MAX72xx_Test.ino:626:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   scrollText("Control  ");

                         ^
/home/zzz/Arduino/libraries/MD_MAX72xx/examples/MD_MAX72xx_Test/MD_MAX72xx_Test.ino:633:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   scrollText("Transform  ");

                           ^
/home/zzz/Arduino/libraries/MD_MAX72xx/examples/MD_MAX72xx_Test/MD_MAX72xx_Test.ino:639:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   scrollText("Charset  ");

                         ^

Sketch uses 15,194 bytes (49%) of program storage space. Maximum is 30,720 bytes.
Global variables use 469 bytes (22%) of dynamic memory, leaving 1,579 bytes for local variables. Maximum is 2,048 bytes.

so it looks like a compatibility issue with the Digispark.

I think the Nano will do what I want. It's (slightly) bigger and costs twice as much, but at £3 or so that's no big deal.

I'd be interested to know if anybody gets the Digispark to work with the MD_MAX72xx library.

Thanks for your help.

OK. If you dial back the compiler warning levels in IDE preferences these messages will disappear, as they are minor and not related to the libraries.

You may also want to look at the Pro Mini as an alternative to the Nano. I usually develop on a Uno but then move the code (basically a recompile) to a Pro Mini when it comes time to embed the project. It is cheaper (on eBay), the footprint is much smaller, and it uses the same processor as the Uno and the Nano. However, with the Pro Mini you need a Serial/USB converter as the USB is omitted form the board (which is why it is cheaper). These are inexpensive and can be reused for programming other Pro Mini boards.

Thanks.

I'll post a progress report in due course.

Hello every one
I have the same problem my question did you fix
Thanks Eddy from WPB