Pages: [1] 2 3 ... 5   Go Down
Author Topic: Attiny85 tone issue  (Read 11783 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Doesn't seem to support tone either.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:


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

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Which board do you have selected?

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ATtiny85 (w/ Arduino as ISP)

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your patience, and moments of sarcasm  smiley-wink.  My sketches are running smoothly! 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 206
Posts: 12849
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: