Error uploading sketch to Digispark

Hello everybody,

I'v got a couple of Arduino nano's which I am learning the basics on. I just started this whole arduino thing and grasp the basics.

Now I've get a 433mhz rx/tx set and a bit of simple code

#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile

#define relay 7

RH_ASK rf_driver;
RH_ASK driver(2000,6); //"2000" standaard snelheid, pin nummer

void setup(){
  
pinMode (relay, OUTPUT);
rf_driver.init();

}

void loop(){

  uint8_t buf[1];
    uint8_t buflen = sizeof(buf);
    if (rf_driver.recv(buf, &buflen)) // Non-blocking
    {
      int i;
      // Message with a good checksum received, dump it.
      
  for (i = 0; i < buflen; i++)
  {
   int c = (buf[i]); 

if (c==49){
  digitalWrite(relay, HIGH);
 
}

else {
  digitalWrite(relay, LOW);
}
  }
    }
}

Even though it looks like a mess (incorrect spacing, enters and placement of brackets and such) it works fine on my Nano!

Now I thought: this can be smaller, so I ot myself a Digispark. I tested this with my i2c lcd 16x2, printed a hello world, made a led blink, measured some temperature. all fine.
But when I want to upload above sketch it gives me an error....

Arduino:1.8.7 (Windows 10), Board:"Digispark (Default - 16.5mhz)"

In file included from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\io.h:99:0,

                 from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\interrupt.h:38,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/WProgram.h:8,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Arduino.h:4,

                 from sketch\433mhz_RX__relais_activation.ino.cpp:1:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h: In member function 'void SPISettings::init_AlwaysInline(uint32_t, uint8_t, uint8_t)':

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:146:16: error: 'SPE' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                ^

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:146:27: error: 'MSTR' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                           ^

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:146:65: error: 'DORD' was not declared in this scope

     spcr = _BV(SPE) | _BV(MSTR) | ((bitOrder == LSBFIRST) ? _BV(DORD) : 0) |

                                                                 ^

In file included from C:\Users\Ten Broeke\Documents\Arduino\433mhz_RX__relais_activation\433mhz_RX__relais_activation.ino:2:0:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h: In static member function 'static void SPIClass::beginTransaction(SPISettings)':

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:203:5: error: 'SPCR' was not declared in this scope

     SPCR = settings.spcr;

     ^

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:204:5: error: 'SPSR' was not declared in this scope

     SPSR = settings.spsr;

     ^

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h: In static member function 'static uint8_t SPIClass::transfer(uint8_t)':

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:209:5: error: 'SPDR' was not declared in this scope

     SPDR = data;

     ^

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:217:14: error: 'SPSR' was not declared in this scope

     while (!(SPSR & _BV(SPIF))) ; // wait

              ^

In file included from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\io.h:99:0,

                 from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\interrupt.h:38,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/WProgram.h:8,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Arduino.h:4,

                 from sketch\433mhz_RX__relais_activation.ino.cpp:1:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:217:25: error: 'SPIF' was not declared in this scope

     while (!(SPSR & _BV(SPIF))) ; // wait

                         ^

In file included from C:\Users\Ten Broeke\Documents\Arduino\433mhz_RX__relais_activation\433mhz_RX__relais_activation.ino:2:0:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h: In static member function 'static uint16_t SPIClass::transfer16(uint16_t)':

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:223:11: error: 'SPCR' was not declared in this scope

     if (!(SPCR & _BV(DORD))) {

           ^
[i][u][b](there is loads more here but i cut it because my post length was over 9000 (ha-ha))[/b][/u][/i]                                                      

In file included from C:\Users\Ten Broeke\Documents\Arduino\433mhz_RX__relais_activation\433mhz_RX__relais_activation.ino:2:0:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h: In static member function 'static void SPIClass::detachInterrupt()':

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:310:42: error: 'SPCR' was not declared in this scope

   inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }

                                          ^

In file included from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\io.h:99:0,

                 from c:\users\ten broeke\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\interrupt.h:38,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/WProgram.h:8,

                 from C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny/Arduino.h:4,

                 from sketch\433mhz_RX__relais_activation.ino.cpp:1:

C:\Users\Ten Broeke\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\SPI/SPI.h:310:55: error: 'SPIE' was not declared in this scope

   inline static void detachInterrupt() { SPCR &= ~_BV(SPIE); }

                                                       ^

exit status 1
Fout bij het compileren voor board Digispark (Default - 16.5mhz)

It is quite a bit of error... and I have no clue what it means! Who could shed some light on this?

It seems to bog down on the spi library, but i wouldnt know how to fix this :frowning:

Kind regards,

Tim

The Digispark uses the AT Tiny85 which does not have built-in SPI support. The nano is based on the AT '328 which does. Are you sure you are compiling this sketch for the proper MCU?

I am awere of the different chipsets.

I added the attiny/digispark to the Arduino IDE. It has worked fine so far.

looking at the pinout of the module it seems to have SPI?

or am i misunderstanding something?

Is there a workaround so that i can still use my digispark, despite the SPI lacking?

Tim