tone() and small speaker

I'm trying to get a small speaker working with tone().

Speaker works great with the Melody tutorial, which was based on bit banging a pin at the right frequency using digitalWrite and delayMicros.

No sound at all when trying the toneMelody tutorial, which uses tone.

Any ideas?

Thanks!

Any ideas?

Without seeing your sketch?
No, probably not.

Umm, see the Melody and toneMelody tutorial sketches mentioned in the original post.

http://www.arduino.cc/en/Tutorial/Melody http://www.arduino.cc/en/Tutorial/Tone

Well the Melody example uses pin 9 and the Tone example uses pin 8.

Did you rewire your speaker when switching to the other example? Or change the pin number in the Sektch?

Indeed, I did move the speaker wire from 9 to 8. Of course leaving the other wire in ground.

Also there should be a resistor in the Melody just like the tone to protect the arduino.

Indeed, 1K resistor is in place. Works with Melody. No work with Tone.

I think I shall try some different speakers next ...

Indeed, 1K resistor is in place.

Well anything above 100R should be enough.

Works with Melody. No work with Tone.

This is odd as I can't see any substantial hardware reason why it would be different with one and the other. I would imagin you get the same results with another speaker.

Are you sure the Tone is producing some output that is, is the software running correctly. For example does the output light an LED (both sourcing and sinking current)?

Thanks for the help, works great with two other speakers. Don't know what, but something was wrong with the one I had ...

What was the "speaker" you were using? Have any pics or specs?

Does the tone example vs the melody example use different pulsing technique (ie, does one only do 0-5V transistion, while the other uses a full-wave swing)...?

Your result is strange; glad you got it working, though...