How to get a ticking

Hi,
I was wondering if anybody knew about ticking sounds and how I might go about generating one. I have a piezo buzzer and wondered if that could be used. If the ticking sound could sound like a clock, that would be perfect.

Another issue is about being able to change the frequency of this tick like a physical metronome
Thanks

You can get a 'tick' noise by connecting your piezo element to a digital output pin an turning that pin on for a brief time.

You can adjust the time between ticks using code from the Digital:BlinkWithoutDelay example.

You can use a potentiometer connected to an analog input for manual control as in the Servo:Knob example.

For a not-too-loud tick, a standard eletromechanical relay.

Thanks for that - I think that it would be better louder - might consider a volume control of some form

Thanks to both of you

Note that a volume control will only turn the volume down.
To turn it up you need an amplifier.

Yes - but if it is already down, I can turn it up

Yes - but if it is already down, I can turn it up

No.