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??