Attiny85 tone issue

I am using the Arduino Duemilanove as an ISP to program an ATtiny85. I simply want the 85 to play a tone however when I upload my sketch (a simple tone test), I get the error message "tone is not defined". Is there a different library I need to use?

Give this core a try... http://code.google.com/p/arduino-tiny/

Doesn't seem to support tone either.

I know for a fact that it does. Post your Sketch.

This is the simplest version of my code. I get the error message "tone not declared in this scope"

const int buttonPin = 3;     // the number of the pushbutton pin
int buttonState = 0;


void setup() {   

  pinMode(buttonPin, INPUT); 
  pinMode(0, OUTPUT);
  pinMode(4, OUTPUT);


}

void loop() {
  
   buttonState = digitalRead(buttonPin);
   
  if (buttonState == HIGH) 
  
  {
  
  tone(4, 2000, 80);            //beep
  delay(80);                       // delay
  digitalWrite(0, HIGH);     // set the LED on
  delay(80);                      // delay
  digitalWrite(0, LOW);     // set the LED off
  delay(80);                      // delay

}
    else {
  }    
  
  }

Which board do you have selected?

Does the Sketch compile if you select "Arduino Uno"?

I’m using the Duemilanove and yes it compiles fine with the arduino selected but will not work when the ATtiny85 is selected.

fotokid: but will not work when the ATtiny85 is selected.

In order for me to help you, you have to provide answers to my questions. In case my question was not clear, I will try wording it a bit differently...

Precisely which ATtiny board do you have selected? Please reply with the exact wording of the menu item.

ATtiny85 (w/ Arduino as ISP)

That is not a board from the core I recommended... http://code.google.com/p/arduino-tiny/source/browse/trunk/hardware/tiny/boards.txt

So I will refer you here for the solution... http://arduino.cc/forum/index.php/topic,61607.msg445240.html#msg445240

I'm not exactly sure how to download this core.. Also, when the core is downloaded, will it be placed in my hardware folder?

fotokid: I'm not exactly sure how to download this core..

Navigate to the site. Navigate to the Downloads tab. Click the first link.

Also, when the core is downloaded, will it be placed in my hardware folder?

readme.txt It's in the download package. Open it. Read it. Follow the instructions.

Thank you for your patience, and moments of sarcasm ;). My sketches are running smoothly!

My sketches compiled fine but when uploading them to the ATtiny85 I got a much different error message and the uploading process never finished. My process is to run the Arduino isp code on the Duemilanove board and then switch to the Attiny85 8mhz board and upload my light/tone sketch.

Is there a different process I am not using?

In the “boards.txt” file there are entries similar to this one…

attiny84at16.upload.using=pololu

If the entry is missing or incorrect, that error message is produced. For the Arduino ISP, the entries should be altered to something like this…

attiny84at16.upload.using=arduino:arduinoisp

I found this:

attiny85arduinoisp.name=ATtiny85 (w/ Arduino as ISP) attiny85arduinoisp.upload.using=arduino:arduinoisp attiny85arduinoisp.upload.maximum_size=8192 attiny85arduinoisp.build.mcu=attiny85 attiny85arduinoisp.build.f_cpu=1000000L attiny85arduinoisp.build.core=attiny45_85

Still the same error message

ATtiny85 (w/ Arduino as ISP)

...is that the board you are using? That you have selected when you upload?

No sorry I copied the wrong one, I need to be using this one:

attiny85at8.upload.using=arduino:arduinoisp

I added this:

attiny85at8.name=ATtiny85 @ 8 MHz (internal oscillator; BOD disabled)
attiny85at8.upload.using=arduino:arduinoisp
attiny85at8.upload.maximum_size=8192
attiny85at8.build.mcu=attiny85
attiny85at8.build.f_cpu=8000000L
attiny85at8.build.core=tiny

it matches the other board.txt formats but still same error message

Well somehow it worked itself out and now my tiny is fully programmed. :grin: