# Error compiling ATtiny85 trinket with IDE

**URL:** <https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667>\
**Category:** Programming\
**Created:** [December 20, 2021, 10:11am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667 "2021-12-20T10:11:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![scruffnut](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@scruffnut](https://forum.arduino.cc/u/scruffnut)\
**Post date:** [December 20, 2021, 10:11am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/1 "2021-12-20T10:11:53Z")

</div>

Hello,

First time using an ATtiny85 and I'm not sure if this is the right place to ask. I've installed the relevant drivers and libraries for Digispark, and a demo code does compile and upload to the board.

I wrote my code and tested on an UNO and everything works as intended. However, I get an error when compiling for Digispark. The error message seems to suggest it's because of FastLED, but anything I can find online suggests that it should work.

> Blockquote In file included from D:\Users\Steve\Documents\Arduino\libraries\FastLED/FastLED.h:65:0,  
> from D:\Users\Steve\Documents\Arduino\LED\_nightlight\LED\_nightlight\_attiny\LED\_nightlight\_attiny.ino:1:  
> D:\Users\Steve\Documents\Arduino\libraries\FastLED/fastspi.h: At global scope:  
> D:\Users\Steve\Documents\Arduino\libraries\FastLED/fastspi.h:130:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output  
> pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"

This might be a very dumb question, but I was under the impression that I can use the same arduino coding for the ATtiny as long as I'm using the arduino ide. But I cannot for the life of me find the answer to this.

I'm at a loss at what I need to do. Any help would be much appreciated.

Thank you.

````arduino
#include <FastLED.h>

#define LED_PIN 5
#define NUM_LEDS 48
//#define BRIGHTNESS 10
#define LED_TYPE WS2812B
CRGB leds[NUM_LEDS];

uint8_t paletteIndex = 0;

int button = 1;
int dimmerButton = 3; 

//int color;
//int readColor;

int brightness;

//main button
int inputDelay = 400;
long int previousInput; 
//int buttonInterval = 1000; 
int buttonCounter = 0;
bool buttonState = 1;
bool lastButtonState = 1;
bool powerState = 0;

//dimmer button 
int dimmerButtonCounter = 0;
bool dimmerButtonState = 1;
bool lastDimmerButtonState = 1;

//timing
unsigned long startTime = 0;
long int timer[] = {5000, 10000, 15000};

long int timeOne = 5000;
long int timeTwo = 10000;
long int timeThree = 15000;

void setup() {
  //delay( 3000 ); // power-up safety delay
  //Serial.begin(9600);

  pinMode(button, INPUT_PULLUP);
  pinMode(dimmerButton, INPUT_PULLUP);
  
  FastLED.addLeds<LED_TYPE, LED_PIN,GRB>(leds, NUM_LEDS);
  FastLED.clear();
  FastLED.show();
 

}

void loop() {

    dimmerButtonState = digitalRead(dimmerButton);
    if(dimmerButtonState != lastDimmerButtonState)
    {
      if(dimmerButtonState == 0)
      {
      dimmerButtonCounter++;
      }
      delay(50);
    }
    lastDimmerButtonState = dimmerButtonState;

  if(dimmerButtonCounter == 0)
  {
    brightness = 30;
  }
  if(dimmerButtonCounter == 1)
  {
    brightness = 60;
  }
  if(dimmerButtonCounter == 2)
  {
    brightness = 90;
  }
  if(dimmerButtonCounter == 3)
  {
    dimmerButtonCounter = 0;
  }
  
  
  
  buttonState = digitalRead(button); 
    if (buttonState != lastButtonState)
    {
      if (buttonState == 0)
      {
      buttonCounter++;
      
      switch(buttonCounter)
  {
    case 0: 
      //Serial.println("0");
      FastLED.clear();
      FastLED.show();
      powerState = 0;
      break;
    case 1: 
      //Serial.println("1");
      startTime = millis(); 
      powerState = 1;
      break;
    case 2: 
      //Serial.println("2");
      startTime = millis();
      powerState = 1;
      break;
    case 3: 
     // Serial.println("3");
      startTime = millis();
      powerState = 1;
      break;
    case 4: 
      //Serial.println("4");
      powerState = 1;
      break;
   }
      }
      delay(50); 
    }
    lastButtonState = buttonState;

  
  if(buttonCounter != 0)
  {
    brightnessSet();   
    setColor();
  }
  
  if(buttonCounter > 4)
  {
    buttonCounter = 0;
   // Serial.println("0");
    FastLED.clear();
    FastLED.show();
    powerState = 0; 
  }
  
  if(powerState && (millis() - startTime > timer[buttonCounter - 1]) && buttonCounter != 4)
  {
    buttonCounter = 0;
    //Serial.println("0");
    FastLED.clear();
    FastLED.show();
    powerState = 0; 
  }

  
  

// Serial.println(average);
}

void setColor() {
  for(int i = 0; i < NUM_LEDS ; i++)
      {
          leds[i] = CRGB(255,85,0);
          FastLED.show();
        }
        
}

void brightnessSet(){
  
  FastLED.setBrightness( brightness );
  FastLED.show();
}```
````

---

<div class="post-metadata">

**Author:** ![HillmanImp](https://avatars.discourse-cdn.com/v4/letter/h/9d8465/32.png) [@HillmanImp](https://forum.arduino.cc/u/HillmanImp)\
**Post date:** [December 20, 2021, 10:30am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/2 "2021-12-20T10:30:00Z")

</div>

Hi.  
I think you have to tell the IDE that the target board is the ATtiny85. Did you do that?

My memory is dim on this, but do you need to install the correct "core"?

Are you using the bare chip or the Digispark board?

---

<div class="post-metadata">

**Author:** ![scruffnut](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@scruffnut](https://forum.arduino.cc/u/scruffnut)\
**Post date:** [December 20, 2021, 11:30am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/3 "2021-12-20T11:30:53Z")

</div>

I am using the board from digispark. I have also set the board to the digispark default 16.5mhz as that is what the tutorials say.

I did successfully upload a demo attiny code with the same setting from the IDE, so my assumption is that there might be something wrong with the compatibility of my code. 😕

---

<div class="post-metadata">

**Author:** ![killzone\_kid](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/killzone_kid/32/1098074_2.png) [@killzone\_kid](https://forum.arduino.cc/u/killzone_kid)\
**Post date:** [December 20, 2021, 11:58am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/4 "2021-12-20T11:58:01Z")

</div>

where is the error? the message you posted is not it

---

<div class="post-metadata">

**Author:** ![ruilviana](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ruilviana/32/722429_2.png) [@ruilviana](https://forum.arduino.cc/u/ruilviana)\
**Post date:** [December 20, 2021, 12:44pm UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/7 "2021-12-20T12:44:37Z")

</div>

Hi  
So it's already been an error:

```cpp
#include <FastLED.h>

void setup() {
}

void loop() {
}

```

I don't know if the library supports Attinyxx.

ref: [GitHub - FastLED/FastLED: The FastLED library for colored LED animation on Arduino. Please direct questions/requests for help to the FastLED Reddit community: http://fastled.io/r We'd like to use github "issues" just for tracking library bugs / enhancements.](https://github.com/FastLED/FastLED)

supported platforms  
Right now the library is supported on a variety of arduino compatible platforms. If it's ARM or AVR and uses the arduino software (or a modified version of it to build) then it is likely supported. Note that we have a long list of upcoming platforms to support, so if you don't see what you're looking for here, ask, it may be on the roadmap (or may already be supported). NB at the moment we are only supporting the stock compilers that ship with the arduino software. Support for upgraded compilers, as well as using AVR studio and skipping the arduino entirely, should be coming in a near future release.

Arduino & compatibles - straight up arduino devices, uno, duo, leonardo, mega, nano, etc...  
Arduino Yun  
Adafruit Trinket & Gemma - Trinket Pro may be supported, but haven't tested to confirm yet  
Teensy 2, Teensy++ 2, Teensy 3.0, Teensy 3.1/3.2, Teensy LC, Teensy 3.5, Teensy 3.6, and Teensy 4.0 - arduino compatible from [pjrc.com](http://pjrc.com) with some extra goodies (note the teensy LC, 3.2, 3.5, 3.6, 4.0 are ARM, not AVR!)  
Arduino Due and the digistump DigiX  
RFduino  
sparkcore  
Arduino Zero  
ESP8266 using the arduino board definitions from [http://arduino.esp8266.com/stable/package\_esp8266com\_index.json](http://arduino.esp8266.com/stable/package_esp8266com_index.json) - please be sure to also read [ESP8266 notes · FastLED/FastLED Wiki · GitHub](https://github.com/FastLED/FastLED/wiki/ESP8266-notes) for information specific to the 8266.  
The wino board - [http://wino-board.com](http://wino-board.com)  
ESP32 based boards  
What types of platforms are we thinking about supporting in the future? Here's a short list: ChipKit32, Maple, Beagleboard

Look this site:

[https://www.ka4designs.com/fastled-attiny85/](https://www.ka4designs.com/fastled-attiny85/)

---

<div class="post-metadata">

**Author:** ![westfw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/westfw/32/213443_2.png) [@westfw](https://forum.arduino.cc/u/westfw)\
**Post date:** [December 21, 2021, 2:34am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/8 "2021-12-21T02:34:42Z")

</div>

> [@scruffnut](#):
>
> I was under the impression that I can use the same arduino coding for the ATtiny as long as I'm using the arduino ide.

Alas, that is largely not true. By the time you get to the sort of very libraries for very timing-dependent external devices (like neopixels), the code tends to become very processor-specific WRT instruction choice, timing decisions, and internal peripheral use.  
**Some** libraries are very carefully written to support many different varieties of Arduino, but many were written with some particular board in mind, without paying any attention to other available boards.

However, the message reported in the original post:

> pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"  
> is not an error, or even a warning. It's just a message, and it means exactly what it says. The "FastLED" stuff will be less fast, because it doesn't have hardware SPI. AFAICT, the library does support the ATtiny85, and your sketch might (should?) work anyway... did you actually try uploading and running it?

if it doesn't work, you could try the standard adafruit neopixel library instead... I know I've had that work on a tiny85... Here's a "programmable any-color LED" (neopixel piggybacked on an ATtiny chip...

 ![image](https://europe1.discourse-cdn.com/arduino/original/4X/0/4/3/043b24d33af68780c3513b81a6ba7fc1bb6c351f.jpeg)

---

<div class="post-metadata">

**Author:** ![scruffnut](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@scruffnut](https://forum.arduino.cc/u/scruffnut)\
**Post date:** [December 21, 2021, 4:38am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/9 "2021-12-21T04:38:04Z")

</div>

Thank you. I will look into using the adafruit library instead. Didn't realize compatibility between boards and libraries was something that needed to be considered.

---

<div class="post-metadata">

**Author:** ![scruffnut](https://avatars.discourse-cdn.com/v4/letter/s/439d5e/32.png) [@scruffnut](https://forum.arduino.cc/u/scruffnut)\
**Post date:** [December 22, 2021, 7:20am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/10 "2021-12-22T07:20:58Z")

</div>

Just wanted to let you know that the Adafruit neopixel library worked. Thank you!

---

<div class="post-metadata">

**Author:** ![killzone\_kid](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/killzone_kid/32/1098074_2.png) [@killzone\_kid](https://forum.arduino.cc/u/killzone_kid)\
**Post date:** [December 22, 2021, 7:47am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/11 "2021-12-22T07:47:13Z")

</div>

how much memory you have left after using it?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [June 20, 2022, 7:47am UTC](https://forum.arduino.cc/t/error-compiling-attiny85-trinket-with-ide/937667/12 "2022-06-20T07:47:43Z")

</div>

Closed on June 20, 2022, 7:47am UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
