Arduino make a Sound
Forgive the newbie super simple question......
So im using the door/window switch sketch with a Doorbell, mostly to send push notifications to phone etc. So far so good on my bread-boarding prototype.
Now i want to add a sounder, either tiny speaker or piezo so as it makes a noise like a ordinary doorbell, mainly so callers realise its working, but also for anyone to hear if not got push notification etc.
The arduino will when fully installed will be run off mains power so not too worried about current draw, just need some simple code and how to edit it into the switch sketch, sorry learning arduino as i go, i know its basic. I googled some basic Tone code to make a sound, but getting confused on how to add it into existing code without breaking switch.
It is very easy to use, just three parameters pinnumber,frequency,duration
So to play a tone on pin 7 at 1200Hz for 60ms you would use
tone(7, 1200, 60);