Countdown Speaker Alarm
Step 1 - Build the Project
This bit of code is an alarm sound from a speaker. The trick to the ‘countdown’ is that the program is delayed by the number of milliseconds inside delay(). The setup code will set the speaker pin as an output, then it will pause for the delay amount of time.
Step 2 - Upload the Code
Step 3 - Read the Walkthrough
When the pause is over, the program will run whatever code is below the delay. In this case, that’s your alarm! If you put this code inside the loop, it will run again and again, so you could create a repeating alarm every minute delay(60000) or every hour delay(3600000). Delay can only go up to about 4.29 million, so a daily alarm isn’t very easy with this method.