I am new to Arduino and microcontrollers, I want to make a tone with my D1 mini and a LSM-50F speaker. But I don't get any output. Any idea what I am doing wrong? Tested it with two D1 mini boards.
This is how I wired everything:

Specifications:
Impedance 45 Ohm
Power (Nominal) 0,2 W
Power (Maximum) 0,5 W
Resonance frequency 450 Hz
The D1 mini's GPIO pins have a maximum of 10 mA, so I am using a 330 Ohm resistor in series to the 45 Ohm speaker to avoid overloading.
I = U/R
I = 3.3 V / 330 Ohm + 45 Ohm
I = 3.3 V / 375 Ohm
I = 8.8 mA
My code:
int Speaker = 5;
void setup()
{
}
void loop()
{
tone(Speaker, 450);
delay(1000);
noTone(Speaker);
}
I also tried a piezo from an old computer in the same setup. Not sure if the piezo is active or passive, so I tried using:
digitalWrite(Speaker, HIGH); // Play a tone on an active piezo.
And
tone(Speaker, 450); // Play a tone on a passive piezo.