tone was not declared in this scope

Hi dear friends,

I am using Arduino IDE 1.8.9 to code the microbit microcontroller.

Would like to play the tone hence downloaded the sample attached. But I encountered the above error.

Wonder if someone can help me with this? I have searched around for recommendation and solution. Have exhausted almost everything suggested.

please help me.

PlayMario.zip (2.7 KB)

You'll receive more help, if you post the code directly here (using code-tags, the </> button in the top left).

int song = 0;

void sing(int s){      
   // iterate over the notes of the melody:
   song = s;
   if(song==2){

Why do you need to store the argument value in a global variable?

Your code includes Tone.h, but you haven't shown us what is in Tone.h. So, we can't help you.