Anything else than tone and noTone for Piezo Speaker?

I am trying to write Mario Theme song for my Photon. I know how to use tone and noTone butit is very tedious and more lines of codes than on C++.

On photon

    tone(b,330);
    delay(100);
    noTone(b);
    delay(100);

On C++

Beep (330,100);Sleep(100);

Is there any other library on Particle Photon that I can use so that I can write less number of codes ?

One option is the [InternetButton library] (https://build.particle.io/libs/55e0a4256b6e3275580009ce/tab/1_Blink_An_LED.cpp) example #8 which shows how to play a song with a string containing note names and durations.

The relevant code is copied into this post, which is much easier to copy and paste from.

3 Likes

@rickkas7 Thank you.

Thanks for your help @rickkas7!