Go Down

Topic: Attiny85 tone issue (Read 13286 times) previous topic - next topic

fotokid

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?


Coding Badly


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

fotokid

Doesn't seem to support tone either.

Coding Badly

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

fotokid

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

Code: [Select]


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 {
  }   
 
  }


Coding Badly


Which board do you have selected?

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

fotokid

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

Coding Badly

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.

fotokid

ATtiny85 (w/ Arduino as ISP)


Coding Badly


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

fotokid

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

Coding Badly

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


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

Quote
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.

fotokid

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

fotokid

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?


Coding Badly

In the "boards.txt" file there are entries similar to this one...

[font=Courier New]attiny84at16.upload.using=pololu[/font]

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

[font=Courier New]attiny84at16.upload.using=arduino:arduinoisp[/font]

Go Up