loading

problem with my code

This is the top of the code where i am getting the error. "Tone speakerpin" is the line that it is talking about.
The error says "Tone" does not name a type.
Please help

#include <Tone.h>
Tone speakerpin;
int starttune[] = {NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_C4, NOTE_F4, NOTE_G4, NOTE_F4, NOTE_E4, NOTE_F4, NOTE_G4};
int duration2[] = {100, 200, 100, 200, 100, 400, 100, 100, 100, 100, 200, 100, 500};
int note[] = {NOTE_C4, NOTE_C4, NOTE_G4, NOTE_C5, NOTE_G4, NOTE_C5};
int duration[] = {100, 100, 100, 300, 100, 300};
boolean button[] = {2, 3, 4, 5}; //The four button input pins
boolean ledpin[] = {8, 9, 10, 11};  // LED pins
int turn = 0;  // turn counter
int buttonstate = 0;  // button state checker
int randomArray[100]; //Intentionally long to store up to 100 inputs (doubtful anyone will get this far)
int inputArray[100];


sort by: active | newest | oldest
Where's the code from ?

What is "Tone", what is "speakerpin" ?
font1135 (author)  steveastrouk4 years ago
i think that is my issue as well but i am not very savy with this program basically i just took the code from this site.
https://www.instructables.com/id/Arduino-Simon-Says/?ALLSTEPS
Was it in the .zip file ?
frollard4 years ago
It means you don't have the Tone.h library installed in your arduino/libraries folder.

You get that error as if tone isn't there because adding Tone.h will define a type but since its not there the type isn't declared.

I presume this is the library you need
http://code.google.com/p/rogue-code/downloads/detail?name=Arduino-Library-Tone.zip
+1, you can include the library in your code all day but it doesn't do any good without actually loading the library into the IDE.
Its got a horribly opaque error message system. Why it can't say "tone.h not ound in path" ?
Agreed;

I bet it does -- He's giving one line of a 15-20 line error.
I recall arduino should give the specific line causing the distress (tone does not name a type) - as well as other info (tone.h not found)