Countdown LED & Speaker Alarm
 

Step 1 - Build the Project

Countdown LED & Speaker Alarm Hookup: 1 speaker in pin A5 and 1 LED in pin 13. Remember the shorter leg of the LED is ground.

Topics Covered:

 

This code uses the delay - your countdown timer - to delay the beginning of the loop, which holds the synchronized LED and speaker alarm.

Step 2 - Upload the Code

1
2
/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

Step 3 - Read the Walkthrough

After setting up both the speaker and the light as outputs, you can use the delay command to put the code on hold. The number of milliseconds within delay can range up to about 4.29 million, so your countdown can last over an hour if you want!

After the delay period has run out, the code drops into the loop, where it will run forever until the power to the Maker Board is turned off or the board is reset.