Electronic – Arduino as ISP for ATtiny

arduinoattinyide

I am attempting to use an Arduino Duemilanove as a tool to program an ATtiny85 from the Arduino IDE.

I was using the instructions at ForkRobotics which are …

  • Upload ArduinoISP sketch to Arduino
  • Connect Arduino pins 7, 8 & 9 to LEDS (heartbeat, error, programming)
  • Connect Arduino Pins 10,11,12,13 to ATtiny85 pins 1,5,6,7 (plus 5V & GND)
  • Download Arduino Tiny code from http://code.google.com/p/arduino-tiny/downloads/list
  • Select Tools -> Board -> ATtiny85 (w/Arduino as ISP)
  • Select Tools -> Programmer -> Arduino as ISP
  • Load the example basic blink sketch (s/pin 13/pin 4/) to the ATtiny85

I can see the ArduinoISP heartbeat LED pulsing but at the last step I get the following errors

Blink.ino:10:21: error: Arduino.h: No such file or directory
Blink.ino: In function 'void setup()':
Blink:15: error: 'OUTPUT' was not declared in this scope
Blink:15: error: 'pinMode' was not declared in this scope

Arduino.h does exist in   ...\Arduino\hardware\arduino\cores\arduino
but not in (for example) ...\Arduino\hardware\attiny45_85\cores\attiny45_85

I made the following exceptions to the process described above …

  • I already had an old 2009 Arduino IDE installed so I started by downloading the latest stable Arduino IDE and installed it in a new directory. I opted not to install USB drivers.
  • I wasn't sure which download to pick from the code.google URL so used attiny45_85.zip from hlt.media.mit.edu instead.

Should there be a ATtiny85-specific Arduino.h in ...\Arduino\hardware\attiny45_85\cores\attiny45_85?
What have I done wrong?

Best Answer

I found a workaround in an Arduino forum thread

Create an Arduino.h in ...\Arduino\hardware\attiny45_85\cores\attiny45_85 containing

#include <WProgram.h>

I still get warning messages

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

but my tiny multi-million-transistor CPU can now wonderously make a LED blink.

enter image description here
somewhere, an AVR engineer is crying into his beer

It seems that the ATtiny45_85 setup for the Arduino IDE was affected by some sort of reorganisation in the internals when Arduino IDE 1.0 was developed.