Problem with tone library

With that "Tone" library you need to create a Tone object, such as:

#include <Tone.h>

Tone tonePin;

const uint8_t speaker = 9;

void setup() 
{
    tonePin.begin(speaker);
    tonePin.play(NOTE_A4);
    delay(1000);
    tonePin.stop();
}
 
void loop() {}
1 Like